in ext/pg_query/pg_query_deparse.c [691:738]
static void deparseDefArg(StringInfo str, Node *arg, bool is_operator_def_arg)
{
if (IsA(arg, TypeName)) // func_type
{
deparseTypeName(str, castNode(TypeName, arg));
}
else if (IsA(arg, List)) // qual_all_Op
{
List *l = castNode(List, arg);
Assert(list_length(l) == 1 || list_length(l) == 2);
// Schema qualified operator
if (list_length(l) == 2)
{
appendStringInfoString(str, "OPERATOR(");
deparseAnyOperator(str, l);
appendStringInfoChar(str, ')');
}
else if (list_length(l) == 1)
{
appendStringInfoString(str, strVal(linitial(l)));
}
}
else if (IsA(arg, Float) || IsA(arg, Integer)) // NumericOnly
{
deparseValue(str, (Value *) arg, DEPARSE_NODE_CONTEXT_NONE);
}
else if (IsA(arg, String))
{
char *s = strVal(arg);
if (!is_operator_def_arg && IsA(arg, String) && strcmp(s, "none") == 0) // NONE
{
appendStringInfoString(str, "NONE");
}
else if (isReservedKeyword(s)) // reserved_keyword
{
appendStringInfoString(str, s);
}
else // Sconst
{
deparseStringLiteral(str, s);
}
}
else
{
Assert(false);
}
}