in ext/pg_query/pg_query_deparse.c [8856:8972]
static void deparseAlterOwnerStmt(StringInfo str, AlterOwnerStmt *alter_owner_stmt)
{
List *l = NULL;
appendStringInfoString(str, "ALTER ");
switch (alter_owner_stmt->objectType)
{
case OBJECT_AGGREGATE:
appendStringInfoString(str, "AGGREGATE ");
deparseAggregateWithArgtypes(str, castNode(ObjectWithArgs, alter_owner_stmt->object));
break;
case OBJECT_COLLATION:
appendStringInfoString(str, "COLLATION ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_CONVERSION:
appendStringInfoString(str, "CONVERSION ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_DATABASE:
appendStringInfoString(str, "DATABASE ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_DOMAIN:
appendStringInfoString(str, "DOMAIN ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_FUNCTION:
appendStringInfoString(str, "FUNCTION ");
deparseFunctionWithArgtypes(str, castNode(ObjectWithArgs, alter_owner_stmt->object));
break;
case OBJECT_LANGUAGE:
appendStringInfoString(str, "LANGUAGE ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_LARGEOBJECT:
appendStringInfoString(str, "LARGE OBJECT ");
deparseNumericOnly(str, (Value *) alter_owner_stmt->object);
break;
case OBJECT_OPERATOR:
appendStringInfoString(str, "OPERATOR ");
deparseOperatorWithArgtypes(str, castNode(ObjectWithArgs, alter_owner_stmt->object));
break;
case OBJECT_OPCLASS:
l = castNode(List, alter_owner_stmt->object);
appendStringInfoString(str, "OPERATOR CLASS ");
deparseAnyNameSkipFirst(str, l);
appendStringInfoString(str, " USING ");
deparseColId(str, strVal(linitial(l)));
break;
case OBJECT_OPFAMILY:
l = castNode(List, alter_owner_stmt->object);
appendStringInfoString(str, "OPERATOR FAMILY ");
deparseAnyNameSkipFirst(str, l);
appendStringInfoString(str, " USING ");
deparseColId(str, strVal(linitial(l)));
break;
case OBJECT_PROCEDURE:
appendStringInfoString(str, "PROCEDURE ");
deparseFunctionWithArgtypes(str, castNode(ObjectWithArgs, alter_owner_stmt->object));
break;
case OBJECT_ROUTINE:
appendStringInfoString(str, "ROUTINE ");
deparseFunctionWithArgtypes(str, castNode(ObjectWithArgs, alter_owner_stmt->object));
break;
case OBJECT_SCHEMA:
appendStringInfoString(str, "SCHEMA ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_TYPE:
appendStringInfoString(str, "TYPE ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_TABLESPACE:
appendStringInfoString(str, "TABLESPACE ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_STATISTIC_EXT:
appendStringInfoString(str, "STATISTICS ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_TSDICTIONARY:
appendStringInfoString(str, "TEXT SEARCH DICTIONARY ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_TSCONFIGURATION:
appendStringInfoString(str, "TEXT SEARCH CONFIGURATION ");
deparseAnyName(str, castNode(List, alter_owner_stmt->object));
break;
case OBJECT_FDW:
appendStringInfoString(str, "FOREIGN DATA WRAPPER ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_FOREIGN_SERVER:
appendStringInfoString(str, "SERVER ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_EVENT_TRIGGER:
appendStringInfoString(str, "EVENT TRIGGER ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_PUBLICATION:
appendStringInfoString(str, "PUBLICATION ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
case OBJECT_SUBSCRIPTION:
appendStringInfoString(str, "SUBSCRIPTION ");
deparseColId(str, strVal(alter_owner_stmt->object));
break;
default:
Assert(false);
}
appendStringInfoString(str, " OWNER TO ");
deparseRoleSpec(str, alter_owner_stmt->newowner);
}