in ext/pg_query/pg_query_deparse.c [4888:5001]
static void deparseSecLabelStmt(StringInfo str, SecLabelStmt *sec_label_stmt)
{
ListCell *lc = NULL;
appendStringInfoString(str, "SECURITY LABEL ");
if (sec_label_stmt->provider != NULL)
{
appendStringInfoString(str, "FOR ");
appendStringInfoString(str, quote_identifier(sec_label_stmt->provider));
appendStringInfoChar(str, ' ');
}
appendStringInfoString(str, "ON ");
switch (sec_label_stmt->objtype)
{
case OBJECT_COLUMN:
appendStringInfoString(str, "COLUMN ");
deparseAnyName(str, castNode(List, sec_label_stmt->object));
break;
case OBJECT_FOREIGN_TABLE:
appendStringInfoString(str, "FOREIGN TABLE ");
deparseAnyName(str, castNode(List, sec_label_stmt->object));
break;
case OBJECT_SEQUENCE:
appendStringInfoString(str, "SEQUENCE ");
deparseAnyName(str, castNode(List, sec_label_stmt->object));
break;
case OBJECT_TABLE:
appendStringInfoString(str, "TABLE ");
deparseAnyName(str, castNode(List, sec_label_stmt->object));
break;
case OBJECT_VIEW:
appendStringInfoString(str, "VIEW ");
deparseAnyName(str, castNode(List, sec_label_stmt->object));
break;
case OBJECT_MATVIEW:
appendStringInfoString(str, "MATERIALIZED VIEW ");
deparseAnyName(str, castNode(List, sec_label_stmt->object));
break;
case OBJECT_DATABASE:
appendStringInfoString(str, "DATABASE ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_EVENT_TRIGGER:
appendStringInfoString(str, "EVENT TRIGGER ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_LANGUAGE:
appendStringInfoString(str, "LANGUAGE ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_PUBLICATION:
appendStringInfoString(str, "PUBLICATION ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_ROLE:
appendStringInfoString(str, "ROLE ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_SCHEMA:
appendStringInfoString(str, "SCHEMA ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_SUBSCRIPTION:
appendStringInfoString(str, "SUBSCRIPTION ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_TABLESPACE:
appendStringInfoString(str, "TABLESPACE ");
appendStringInfoString(str, quote_identifier(strVal(sec_label_stmt->object)));
break;
case OBJECT_TYPE:
appendStringInfoString(str, "TYPE ");
deparseTypeName(str, castNode(TypeName, sec_label_stmt->object));
break;
case OBJECT_DOMAIN:
appendStringInfoString(str, "DOMAIN ");
deparseTypeName(str, castNode(TypeName, sec_label_stmt->object));
break;
case OBJECT_AGGREGATE:
appendStringInfoString(str, "AGGREGATE ");
deparseAggregateWithArgtypes(str, castNode(ObjectWithArgs, sec_label_stmt->object));
break;
case OBJECT_FUNCTION:
appendStringInfoString(str, "FUNCTION ");
deparseFunctionWithArgtypes(str, castNode(ObjectWithArgs, sec_label_stmt->object));
break;
case OBJECT_LARGEOBJECT:
appendStringInfoString(str, "LARGE OBJECT ");
deparseValue(str, (Value *) sec_label_stmt->object, DEPARSE_NODE_CONTEXT_CONSTANT);
break;
case OBJECT_PROCEDURE:
appendStringInfoString(str, "PROCEDURE ");
deparseFunctionWithArgtypes(str, castNode(ObjectWithArgs, sec_label_stmt->object));
break;
case OBJECT_ROUTINE:
appendStringInfoString(str, "ROUTINE ");
deparseFunctionWithArgtypes(str, castNode(ObjectWithArgs, sec_label_stmt->object));
break;
default:
// Not supported in the parser
Assert(false);
break;
}
appendStringInfoString(str, " IS ");
if (sec_label_stmt->label != NULL)
deparseStringLiteral(str, sec_label_stmt->label);
else
appendStringInfoString(str, "NULL");
}