示例#1
0
/*
 * Executes an ALTER OBJECT / SET SCHEMA statement.  Based on the object
 * type, the function appropriate to that type is executed.
 */
void
ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
{
    switch (stmt->objectType)
    {
    case OBJECT_AGGREGATE:
        AlterFunctionNamespace(stmt->object, stmt->objarg, true,
                               stmt->newschema);
        break;

    case OBJECT_FUNCTION:
        AlterFunctionNamespace(stmt->object, stmt->objarg, false,
                               stmt->newschema);
        break;

    case OBJECT_SEQUENCE:
    case OBJECT_TABLE:
        CheckRelationOwnership(stmt->relation, true);
        AlterTableNamespace(stmt->relation, stmt->newschema);
        break;

    case OBJECT_TYPE:
    case OBJECT_DOMAIN:
        AlterTypeNamespace(stmt->object, stmt->newschema);
        break;

    default:
        elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d",
             (int) stmt->objectType);
    }
}
示例#2
0
文件: alter.c 项目: MicroMirror/gpdb
/*
 * Executes an ALTER OBJECT / SET SCHEMA statement.  Based on the object
 * type, the function appropriate to that type is executed.
 */
void
ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
{
	switch (stmt->objectType)
	{
		case OBJECT_AGGREGATE:
			AlterFunctionNamespace(stmt->object, stmt->objarg, true,
								   stmt->newschema);
			break;

		case OBJECT_FUNCTION:
			AlterFunctionNamespace(stmt->object, stmt->objarg, false,
								   stmt->newschema);
			break;

		case OBJECT_SEQUENCE:
		case OBJECT_TABLE:
			CheckRelationOwnership(stmt->relation, true);
			AlterTableNamespace(stmt->relation, stmt->newschema);
			break;

		case OBJECT_TYPE:
		case OBJECT_DOMAIN:
			AlterTypeNamespace(stmt->object, stmt->newschema);
			break;

		default:
			elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d",
				 (int) stmt->objectType);
	}
	if (Gp_role == GP_ROLE_DISPATCH)
	{
		CdbDispatchUtilityStatement((Node *) stmt, "ExecAlterObjectSchemaStmt");
	}
}