63 #include "utils/fmgroids.h"
82 #define PRETTYINDENT_STD 8
83 #define PRETTYINDENT_JOIN 4
84 #define PRETTYINDENT_VAR 4
86 #define PRETTYINDENT_LIMIT 40
89 #define PRETTYFLAG_PAREN 0x0001
90 #define PRETTYFLAG_INDENT 0x0002
91 #define PRETTYFLAG_SCHEMA 0x0004
94 #define GET_PRETTY_FLAGS(pretty) \
95 ((pretty) ? (PRETTYFLAG_PAREN | PRETTYFLAG_INDENT | PRETTYFLAG_SCHEMA) \
99 #define WRAP_COLUMN_DEFAULT 0
102 #define PRETTY_PAREN(context) ((context)->prettyFlags & PRETTYFLAG_PAREN)
103 #define PRETTY_INDENT(context) ((context)->prettyFlags & PRETTYFLAG_INDENT)
104 #define PRETTY_SCHEMA(context) ((context)->prettyFlags & PRETTYFLAG_SCHEMA)
296 #define deparse_columns_fetch(rangetable_index, dpns) \
297 ((deparse_columns *) list_nth((dpns)->rtable_columns, (rangetable_index)-1))
320 static const char *
const query_getviewrule =
"SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2";
335 bool forceprefix,
bool showimplicit,
336 int prettyFlags,
int startIndent);
338 int prettyFlags,
int wrapColumn);
344 const Oid *excludeOps,
345 bool attrsOnly,
bool keysOnly,
346 bool showTblSpc,
bool inherits,
347 int prettyFlags,
bool missing_ok);
351 bool attrsOnly,
bool missing_ok);
353 int prettyFlags,
bool missing_ok);
356 bool print_table_args,
bool print_defaults);
363 List *parent_namespaces);
395 int prettyFlags,
int wrapColumn);
397 TupleDesc resultDesc,
bool colNamesVisible,
398 int prettyFlags,
int wrapColumn,
int startIndent);
402 TupleDesc resultDesc,
bool colNamesVisible);
404 bool colNamesVisible);
406 bool colNamesVisible);
411 bool colNamesVisible);
413 bool colNamesVisible);
416 TupleDesc resultDesc,
bool colNamesVisible);
418 TupleDesc resultDesc,
bool colNamesVisible);
421 TupleDesc resultDesc,
bool colNamesVisible);
444 int indentBefore,
int indentAfter,
int indentPlus);
462 const char *
options,
bool is_json_objectagg);
468 bool is_json_objectagg);
484 bool is_json_objectagg);
511 bool has_variadic,
bool *use_variadic_p,
520 #define only_marker(rte) ((rte)->inh ? "" : "ONLY ")
597 argtypes[0] = OIDOID;
612 elog(
ERROR,
"failed to get pg_rewrite tuple for rule %u", ruleoid);
790 argtypes[0] = OIDOID;
791 argtypes[1] = NAMEOID;
808 elog(
ERROR,
"failed to get pg_rewrite tuple for view %u", viewoid);
917 tgname =
NameStr(trigrec->tgname);
919 OidIsValid(trigrec->tgconstraint) ?
"CONSTRAINT " :
"",
922 if (TRIGGER_FOR_BEFORE(trigrec->tgtype))
924 else if (TRIGGER_FOR_AFTER(trigrec->tgtype))
926 else if (TRIGGER_FOR_INSTEAD(trigrec->tgtype))
929 elog(
ERROR,
"unexpected tgtype value: %d", trigrec->tgtype);
931 if (TRIGGER_FOR_INSERT(trigrec->tgtype))
936 if (TRIGGER_FOR_DELETE(trigrec->tgtype))
944 if (TRIGGER_FOR_UPDATE(trigrec->tgtype))
952 if (trigrec->tgattr.dim1 > 0)
957 for (
i = 0;
i < trigrec->tgattr.dim1;
i++)
964 trigrec->tgattr.values[
i],
false);
969 if (TRIGGER_FOR_TRUNCATE(trigrec->tgtype))
992 if (!trigrec->tgdeferrable)
995 if (trigrec->tginitdeferred)
1013 if (tgoldtable != NULL || tgnewtable != NULL)
1016 if (tgoldtable != NULL)
1019 if (tgnewtable != NULL)
1024 if (TRIGGER_FOR_ROW(trigrec->tgtype))
1050 oldrte->
relid = trigrec->tgrelid;
1056 oldrte->
inh =
false;
1061 newrte->
relid = trigrec->tgrelid;
1067 newrte->
inh =
false;
1071 memset(&dpns, 0,
sizeof(dpns));
1101 if (trigrec->tgnargs > 0)
1109 elog(
ERROR,
"tgargs is null for trigger %u", trigid);
1111 for (
i = 0;
i < trigrec->tgnargs;
i++)
1213 prettyFlags,
false);
1229 prettyFlags,
false);
1240 const Oid *excludeOps,
1241 bool attrsOnly,
bool keysOnly,
1242 bool showTblSpc,
bool inherits,
1243 int prettyFlags,
bool missing_ok)
1246 bool isConstraint = (excludeOps != NULL);
1260 Datum indclassDatum;
1261 Datum indoptionDatum;
1277 elog(
ERROR,
"cache lookup failed for index %u", indexrelid);
1281 indrelid = idxrec->indrelid;
1282 Assert(indexrelid == idxrec->indexrelid);
1286 Anum_pg_index_indcollation);
1290 Anum_pg_index_indclass);
1294 Anum_pg_index_indoption);
1302 elog(
ERROR,
"cache lookup failed for relation %u", indexrelid);
1310 elog(
ERROR,
"cache lookup failed for access method %u",
1328 Anum_pg_index_indexprs);
1350 idxrec->indisunique ?
"UNIQUE " :
"",
1352 idxrelrec->relkind == RELKIND_PARTITIONED_INDEX
1353 && !inherits ?
"ONLY " :
"",
1367 for (keyno = 0; keyno < idxrec->indnatts; keyno++)
1371 Oid keycolcollation;
1376 if (keysOnly && keyno >= idxrec->indnkeyatts)
1380 if (!colno && keyno == idxrec->indnkeyatts)
1397 if (!colno || colno == keyno + 1)
1400 &keycoltype, &keycoltypmod,
1408 if (indexpr_item == NULL)
1409 elog(
ERROR,
"too few entries in indexprs list");
1411 indexpr_item =
lnext(indexprs, indexpr_item);
1415 if (!colno || colno == keyno + 1)
1428 if (!attrsOnly && keyno < idxrec->indnkeyatts &&
1429 (!colno || colno == keyno + 1))
1432 Oid indcoll = indcollation->
values[keyno];
1434 bool has_options = attoptions != (
Datum) 0;
1437 if (
OidIsValid(indcoll) && indcoll != keycolcollation)
1456 if (opt & INDOPTION_DESC)
1460 if (!(opt & INDOPTION_NULLS_FIRST))
1465 if (opt & INDOPTION_NULLS_FIRST)
1471 if (excludeOps != NULL)
1483 if (idxrec->indnullsnotdistinct)
1524 Anum_pg_index_indpred);
1633 bool ndistinct_enabled;
1634 bool dependencies_enabled;
1649 elog(
ERROR,
"cache lookup failed for statistics object %u", statextid);
1653 has_exprs = !
heap_attisnull(statexttup, Anum_pg_statistic_ext_stxexprs, NULL);
1668 Anum_pg_statistic_ext_stxexprs);
1677 ncolumns = statextrec->stxkeys.dim1 +
list_length(exprs);
1686 NameStr(statextrec->stxname)));
1693 Anum_pg_statistic_ext_stxkind);
1698 elog(
ERROR,
"stxkind is not a 1-D char array");
1701 ndistinct_enabled =
false;
1702 dependencies_enabled =
false;
1703 mcv_enabled =
false;
1707 if (enabled[
i] == STATS_EXT_NDISTINCT)
1708 ndistinct_enabled =
true;
1709 else if (enabled[
i] == STATS_EXT_DEPENDENCIES)
1710 dependencies_enabled =
true;
1711 else if (enabled[
i] == STATS_EXT_MCV)
1728 if ((!ndistinct_enabled || !dependencies_enabled || !mcv_enabled) &&
1731 bool gotone =
false;
1735 if (ndistinct_enabled)
1741 if (dependencies_enabled)
1757 for (colno = 0; colno < statextrec->stxkeys.dim1; colno++)
1771 statextrec->stxrelid);
1826 has_exprs = !
heap_attisnull(statexttup, Anum_pg_statistic_ext_stxexprs, NULL);
1841 Anum_pg_statistic_ext_stxexprs);
1847 statextrec->stxrelid);
1907 bool attrsOnly,
bool missing_ok)
1927 elog(
ERROR,
"cache lookup failed for partition key of %u", relid);
1932 Assert(form->partrelid == relid);
1936 Anum_pg_partitioned_table_partclass);
1940 Anum_pg_partitioned_table_partcollation);
1949 if (!
heap_attisnull(tuple, Anum_pg_partitioned_table_partexprs, NULL))
1955 Anum_pg_partitioned_table_partexprs);
1960 elog(
ERROR,
"unexpected node type found in partexprs: %d",
1973 switch (form->partstrat)
1988 elog(
ERROR,
"unexpected partition strategy: %d",
1989 (
int) form->partstrat);
1995 for (keyno = 0; keyno < form->partnatts; keyno++)
1999 Oid keycolcollation;
2013 &keycoltype, &keycoltypmod,
2021 if (partexpr_item == NULL)
2022 elog(
ERROR,
"too few entries in partexprs list");
2024 partexpr_item =
lnext(partexprs, partexpr_item);
2040 partcoll = partcollation->
values[keyno];
2041 if (!attrsOnly &&
OidIsValid(partcoll) && partcoll != keycolcollation)
2076 if (constr_expr == NULL)
2085 false, prettyFlags, 0);
2163 int prettyFlags,
bool missing_ok)
2174 Anum_pg_constraint_oid,
2179 ConstraintOidIndexId,
2201 elog(
ERROR,
"could not find tuple for constraint %u", constraintId);
2233 switch (conForm->contype)
2235 case CONSTRAINT_FOREIGN:
2246 Anum_pg_constraint_conkey);
2257 Anum_pg_constraint_confkey);
2264 switch (conForm->confmatchtype)
2267 string =
" MATCH FULL";
2270 string =
" MATCH PARTIAL";
2276 elog(
ERROR,
"unrecognized confmatchtype: %d",
2277 conForm->confmatchtype);
2284 switch (conForm->confupdtype)
2290 string =
"RESTRICT";
2296 string =
"SET NULL";
2299 string =
"SET DEFAULT";
2302 elog(
ERROR,
"unrecognized confupdtype: %d",
2303 conForm->confupdtype);
2310 switch (conForm->confdeltype)
2316 string =
"RESTRICT";
2322 string =
"SET NULL";
2325 string =
"SET DEFAULT";
2328 elog(
ERROR,
"unrecognized confdeltype: %d",
2329 conForm->confdeltype);
2341 Anum_pg_constraint_confdelsetcols, &isnull);
2351 case CONSTRAINT_PRIMARY:
2352 case CONSTRAINT_UNIQUE:
2360 if (conForm->contype == CONSTRAINT_PRIMARY)
2365 indexId = conForm->conindid;
2369 elog(
ERROR,
"cache lookup failed for index %u", indexId);
2370 if (conForm->contype == CONSTRAINT_UNIQUE &&
2378 Anum_pg_constraint_conkey);
2381 if (conForm->conperiod)
2388 Anum_pg_index_indnatts);
2399 Anum_pg_index_indkey);
2402 &keys, NULL, &nKeys);
2404 for (
j = keyatts;
j < nKeys;
j++)
2445 case CONSTRAINT_CHECK:
2455 Anum_pg_constraint_conbin);
2490 conForm->connoinherit ?
" NO INHERIT" :
"");
2493 case CONSTRAINT_NOTNULL:
2507 case CONSTRAINT_TRIGGER:
2517 case CONSTRAINT_EXCLUSION:
2519 Oid indexOid = conForm->conindid;
2528 Anum_pg_constraint_conexclop);
2531 &elems, NULL, &nElems);
2534 for (
i = 0;
i < nElems;
i++)
2552 elog(
ERROR,
"invalid constraint type \"%c\"", conForm->contype);
2556 if (conForm->condeferrable)
2558 if (conForm->condeferred)
2560 if (!conForm->convalidated)
2586 &keys, NULL, &nKeys);
2588 for (
j = 0;
j < nKeys;
j++)
2693 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2694 errmsg(
"input is a query, not an expression")));
2705 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2706 errmsg(
"expression contains variables of more than one relation")));
2712 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2713 errmsg(
"expression contains variables")));
2769 *result = role_rec->rolname;
2811 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2812 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2819 Anum_pg_depend_refclassid,
2823 Anum_pg_depend_refobjid,
2827 Anum_pg_depend_refobjsubid,
2843 if (deprec->classid == RelationRelationId &&
2844 deprec->objsubid == 0 &&
2849 sequenceId = deprec->objid;
2907 if (proc->prokind == PROKIND_AGGREGATE)
2909 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2910 errmsg(
"\"%s\" is an aggregate function",
name)));
2912 isfunction = (proc->prokind != PROKIND_PROCEDURE);
2920 isfunction ?
"FUNCTION" :
"PROCEDURE",
2939 if (proc->prokind == PROKIND_WINDOW)
2941 switch (proc->provolatile)
2943 case PROVOLATILE_IMMUTABLE:
2946 case PROVOLATILE_STABLE:
2949 case PROVOLATILE_VOLATILE:
2953 switch (proc->proparallel)
2955 case PROPARALLEL_SAFE:
2958 case PROPARALLEL_RESTRICTED:
2961 case PROPARALLEL_UNSAFE:
2965 if (proc->proisstrict)
2967 if (proc->prosecdef)
2969 if (proc->proleakproof)
2973 if (proc->prolang == INTERNALlanguageId ||
2974 proc->prolang == ClanguageId)
2978 if (proc->procost != procost)
2981 if (proc->prorows > 0 && proc->prorows != 1000)
2984 if (proc->prosupport)
2992 argtypes[0] = INTERNALOID;
2999 if (oldlen !=
buf.len)
3003 tmp =
SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_proconfig, &isnull);
3028 pos = strchr(configitem,
'=');
3061 elog(
ERROR,
"invalid list syntax in proconfig item");
3063 foreach(lc, namelist)
3065 char *curname = (
char *)
lfirst(lc);
3068 if (
lnext(namelist, lc))
3080 (void)
SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_prosqlbody, &isnull);
3081 if (proc->prolang == SQLlanguageId && !isnull)
3089 tmp =
SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_probin, &isnull);
3110 while (strstr(prosrc, dq.
data) != NULL)
3222 if (proc->proretset)
3236 if (proc->proretset)
3253 bool print_table_args,
bool print_defaults)
3260 int insertorderbyat = -1;
3269 &argtypes, &argnames, &argmodes);
3271 nlackdefaults = numargs;
3272 if (print_defaults && proc->pronargdefaults > 0)
3274 Datum proargdefaults;
3278 Anum_pg_proc_proargdefaults,
3287 nextargdefault =
list_head(argdefaults);
3289 nlackdefaults = proc->pronargs -
list_length(argdefaults);
3294 if (proc->prokind == PROKIND_AGGREGATE)
3301 elog(
ERROR,
"cache lookup failed for aggregate %u",
3304 if (AGGKIND_IS_ORDERED_SET(agg->aggkind))
3305 insertorderbyat = agg->aggnumdirectargs;
3311 for (
i = 0;
i < numargs;
i++)
3313 Oid argtype = argtypes[
i];
3314 char *argname = argnames ? argnames[
i] : NULL;
3315 char argmode = argmodes ? argmodes[
i] : PROARGMODE_IN;
3316 const char *modename;
3327 if (proc->prokind == PROKIND_PROCEDURE)
3333 case PROARGMODE_INOUT:
3334 modename =
"INOUT ";
3337 case PROARGMODE_OUT:
3341 case PROARGMODE_VARIADIC:
3342 modename =
"VARIADIC ";
3345 case PROARGMODE_TABLE:
3350 elog(
ERROR,
"invalid parameter mode '%c'", argmode);
3358 if (print_table_args != (argmode == PROARGMODE_TABLE))
3361 if (argsprinted == insertorderbyat)
3367 else if (argsprinted)
3371 if (argname && argname[0])
3374 if (print_defaults && isinput && inputargno > nlackdefaults)
3378 Assert(nextargdefault != NULL);
3380 nextargdefault =
lnext(argdefaults, nextargdefault);
3388 if (argsprinted == insertorderbyat &&
i == numargs - 1)
3392 print_defaults =
false;
3403 || argmodes[nth] == PROARGMODE_IN
3404 || argmodes[nth] == PROARGMODE_INOUT
3405 || argmodes[nth] == PROARGMODE_VARIADIC);
3423 for (
i = 0;
i < ntypes;
i++)
3455 Datum proargdefaults;
3464 if (nth_arg < 1 || nth_arg > numargs || !
is_input_argument(nth_arg - 1, argmodes))
3471 for (
i = 0;
i < nth_arg;
i++)
3476 Anum_pg_proc_proargdefaults,
3494 nth_default = nth_inputarg - 1 - (proc->pronargs - proc->pronargdefaults);
3496 if (nth_default < 0 || nth_default >=
list_length(argdefaults))
3501 node =
list_nth(argdefaults, nth_default);
3522 &argtypes, &argnames, &argmodes);
3578 (void)
SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_prosqlbody, &isnull);
3600 bool forceprefix,
bool showimplicit)
3603 showimplicit, 0, 0);
3627 bool forceprefix,
bool showimplicit,
3628 int prettyFlags,
int startIndent)
3670 rte->
relkind = RELKIND_RELATION;
3728 Assert(crelid > 0 && crelid <= ntables);
3800 memset(&dpns, 0,
sizeof(dpns));
3847 names_hash =
hash_create(
"set_rtable_names names",
3853 foreach(lc, parent_namespaces)
3860 char *oldname = (
char *)
lfirst(lc2);
3862 if (oldname == NULL)
3875 foreach(lc, dpns->
rtable)
3888 else if (rte->
alias)
3924 int refnamelen = strlen(refname);
3925 char *modname = (
char *)
palloc(refnamelen + 16);
3933 memcpy(modname, refname, refnamelen);
3971 List *parent_namespaces)
4098 if (
j->alias == NULL &&
j->usingClause)
4124 elog(
ERROR,
"unrecognized node type: %d",
4182 if (rte->
alias == NULL)
4188 if (colname == NULL)
4192 if (leftattnos[
i] > 0)
4195 leftcolinfo->
colnames[leftattnos[
i] - 1] = colname;
4199 if (rightattnos[
i] > 0)
4202 rightcolinfo->
colnames[rightattnos[
i] - 1] = colname;
4240 foreach(lc,
j->usingClause)
4245 Assert(leftattnos[
i] != 0 && rightattnos[
i] != 0);
4266 parentUsing =
lappend(parentUsing, colname);
4269 if (leftattnos[
i] > 0)
4272 leftcolinfo->
colnames[leftattnos[
i] - 1] = colname;
4276 if (rightattnos[
i] > 0)
4279 rightcolinfo->
colnames[rightattnos[
i] - 1] = colname;
4295 elog(
ERROR,
"unrecognized node type: %d",
4311 char **real_colnames;
4331 ncolumns = tupdesc->
natts;
4332 real_colnames = (
char **)
palloc(ncolumns *
sizeof(
char *));
4334 for (
i = 0;
i < ncolumns;
i++)
4338 if (attr->attisdropped)
4339 real_colnames[
i] = NULL;
4376 real_colnames = (
char **)
palloc(ncolumns *
sizeof(
char *));
4379 foreach(lc, colnames)
4387 if (
cname[0] ==
'\0')
4389 real_colnames[
i] =
cname;
4423 changed_any =
false;
4425 for (
i = 0;
i < ncolumns;
i++)
4427 char *real_colname = real_colnames[
i];
4431 if (real_colname == NULL)
4438 if (colname == NULL)
4444 colname = real_colname;
4459 if (!changed_any && strcmp(colname, real_colname) != 0)
4539 changed_any =
false;
4560 if (real_colname == NULL)
4567 if (rte->
alias == NULL)
4574 if (colname == NULL)
4580 colname = real_colname;
4589 if (!changed_any && strcmp(colname, real_colname) != 0)
4624 while (
i < noldcolumns &&
4650 while (ic < leftcolinfo->num_cols &&
4653 Assert(ic < leftcolinfo->num_cols);
4659 while (i < colinfo->num_cols &&
4662 Assert(i < colinfo->num_cols);
4674 if (rte->
alias != NULL)
4699 while (ic < rightcolinfo->num_cols &&
4700 rightcolinfo->
colnames[ic] == NULL)
4702 Assert(ic < rightcolinfo->num_cols);
4708 while (i < colinfo->num_cols &&
4711 Assert(i < colinfo->num_cols);
4723 if (rte->
alias != NULL)
4740 #ifdef USE_ASSERT_CHECKING
4741 while (i < colinfo->num_cols && colinfo->
colnames[
i] == NULL)
4751 if (rte->
alias != NULL)
4774 if (oldname && strcmp(oldname, colname) == 0)
4786 if (oldname && strcmp(oldname, colname) == 0)
4793 char *oldname = (
char *)
lfirst(lc);
4795 if (strcmp(oldname, colname) == 0)
4802 char *oldname = (
char *)
lfirst(lc);
4804 if (strcmp(oldname, colname) == 0)
4827 int colnamelen = strlen(colname);
4828 char *modname = (
char *)
palloc(colnamelen + 16);
4836 memcpy(modname, colname, colnamelen);
4837 sprintf(modname + colnamelen,
"_%d",
i);
4889 elog(
ERROR,
"unrecognized node type in jointree: %d",
4896 elog(
ERROR,
"unrecognized node type in jointree: %d",
4928 if (rcolno < jrte->joinmergedcols)
4934 Assert(jcolno == numjoincols);
5055 elog(
ERROR,
"could not find RecursiveUnion for WorkTableScan with wtParam %d",
5202 Assert(ev_action != NULL);
5205 elog(
ERROR,
"invalid empty ev_action list");
5242 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5243 errmsg(
"rule \"%s\" has unsupported event type %d",
5244 rulename, ev_type)));
5255 if (strcmp(ev_qual,
"<>") != 0)
5347 int prettyFlags,
int wrapColumn)
5385 Assert(ev_action != NULL);
5396 if (ev_type !=
'1' || !is_instead ||
5406 prettyFlags, wrapColumn, 0);
5432 TupleDesc resultDesc,
bool colNamesVisible,
5433 int prettyFlags,
int wrapColumn,
int startIndent)
5498 elog(
ERROR,
"unrecognized query command type: %d",
5512 bool first_list =
true;
5517 foreach(vtl, values_lists)
5520 bool first_col =
true;
5529 foreach(lc, sublist)
5567 if (query->hasRecursive)
5568 sep =
"WITH RECURSIVE ";
5577 if (cte->aliascolnames)
5583 foreach(col, cte->aliascolnames)
5617 if (cte->search_clause)
5623 cte->search_clause->search_breadth_first ?
"BREADTH" :
"DEPTH");
5625 foreach(lc, cte->search_clause->search_col_list)
5638 if (cte->cycle_clause)
5645 foreach(lc, cte->cycle_clause->cycle_col_list)
5665 get_rule_expr(cte->cycle_clause->cycle_mark_value, context,
false);
5667 get_rule_expr(cte->cycle_clause->cycle_mark_default, context,
false);
5692 TupleDesc resultDesc,
bool colNamesVisible)
5695 List *save_windowclause;
5696 List *save_windowtlist;
5724 force_colno =
false;
5733 force_colno, context);
5768 if (query->hasForUpdate)
5782 elog(
ERROR,
"unrecognized LockClauseStrength %d",
5833 foreach(lc, query->
rtable)
5877 if (resultDesc && colno <= resultDesc->natts)
5880 colname = tle->resname;
5883 if (colname == NULL || strcmp(colname,
cname) != 0)
5893 TupleDesc resultDesc,
bool colNamesVisible)
5921 if (query->isReturn)
5929 if (query->hasDistinctOn)
6027 TupleDesc resultDesc,
bool colNamesVisible)
6031 bool last_was_multiline =
false;
6041 foreach(l, targetList)
6059 context->
buf = &targetbuf;
6084 attname = colNamesVisible ? NULL :
"?column?";
6093 if (resultDesc && colno <= resultDesc->natts)
6096 colname = tle->resname;
6114 if (targetbuf.
len > 0 && targetbuf.
data[0] ==
'\n')
6117 leading_nl_pos = -1;
6120 if (leading_nl_pos >= 0)
6130 trailing_nl = strrchr(
buf->data,
'\n');
6131 if (trailing_nl == NULL)
6132 trailing_nl =
buf->data;
6142 ((strlen(trailing_nl) + targetbuf.
len > context->
wrapColumn) ||
6143 last_was_multiline))
6149 last_was_multiline =
6150 (strchr(targetbuf.
data + leading_nl_pos + 1,
'\n') != NULL);
6163 TupleDesc resultDesc,
bool colNamesVisible)
6178 Assert(subquery != NULL);
6181 need_paren = (subquery->
cteList ||
6285 elog(
ERROR,
"unrecognized node type: %d",
6322 else if (!expr ||
IsA(expr,
Var))
6358 bool omit_child_parens =
true;
6395 omit_child_parens =
false;
6421 foreach(l, orderList)
6430 force_colno, context);
6482 if (wc->name == NULL)
6507 bool needspace =
false;
6613 bool colNamesVisible)
6621 List *strippedexprs;
6630 foreach(l, query->
rtable)
6637 elog(
ERROR,
"too many subquery RTEs in INSERT");
6644 elog(
ERROR,
"too many values RTEs in INSERT");
6648 if (select_rte && values_rte)
6649 elog(
ERROR,
"both subquery and values RTEs in INSERT");
6675 strippedexprs =
NIL;
6706 strippedexprs =
lappend(strippedexprs,
6713 if (query->override)
6729 else if (values_rte)
6734 else if (strippedexprs)
6765 bool save_varprefix;
6787 elog(
ERROR,
"cache lookup failed for constraint %u",
6830 bool colNamesVisible)
6892 int remaining_ma_columns;
6903 if (query->hasSubLinks)
6905 foreach(l, targetList)
6915 ma_sublinks =
lappend(ma_sublinks, sl);
6922 cur_ma_sublink = NULL;
6923 remaining_ma_columns = 0;
6927 foreach(l, targetList)
6943 if (next_ma_cell != NULL && cur_ma_sublink == NULL)
6989 next_ma_cell =
lnext(ma_sublinks, next_ma_cell);
6992 ((cur_ma_sublink->
subLinkId << 16) | 1));
7017 if (cur_ma_sublink != NULL)
7019 if (--remaining_ma_columns > 0)
7022 expr = (
Node *) cur_ma_sublink;
7023 cur_ma_sublink = NULL;
7039 bool colNamesVisible)
7091 bool colNamesVisible)
7145 const char *sep =
"";
7152 foreach(lc2,
action->targetList)
7165 strippedexprs =
lappend(strippedexprs,
7238 elog(
ERROR,
"unexpected utility statement type");
7278 elog(
ERROR,
"bogus varlevelsup: %d offset %d",
7291 if (var->varnosyn > 0 && dpns->
plan == NULL)
7293 varno = var->varnosyn;
7294 varattno = var->varattnosyn;
7330 pvarattno = appinfo->parent_colnos[pvarattno - 1];
7350 varattno = pvarattno;
7386 elog(
ERROR,
"invalid attnum %d for relation \"%s\"",
7389 Assert(netlevelsup == 0);
7421 elog(
ERROR,
"cannot decompile join alias var in plan tree");
7428 if (aliasvar &&
IsA(aliasvar,
Var))
7431 istoplevel, context);
7449 elog(
ERROR,
"invalid attnum %d for relation \"%s\"",
7529 (*callback) (node, context, callback_arg);
7604 (*callback) (node, context, callback_arg);
7646 if (fieldno > 0 && fieldno <=
list_length(r->colnames))
7678 var->vartype != RECORDOID)
7682 Assert(fieldno >= 1 && fieldno <= tupleDesc->natts);
7689 elog(
ERROR,
"bogus varlevelsup: %d offset %d",
7699 if (var->varnosyn > 0 && dpns->
plan == NULL)
7701 varno = var->varnosyn;
7702 varattno = var->varattnosyn;
7732 elog(
ERROR,
"bogus varattno for OUTER_VAR var: %d", varattno);
7734 Assert(netlevelsup == 0);
7751 elog(
ERROR,
"bogus varattno for INNER_VAR var: %d", varattno);
7753 Assert(netlevelsup == 0);
7769 elog(
ERROR,
"bogus varattno for INDEX_VAR var: %d", varattno);
7771 Assert(netlevelsup == 0);
7797 expr = (
Node *) var;
7820 if (ste == NULL || ste->resjunk)
7821 elog(
ERROR,
"subquery %s does not have attribute %d",
7836 List *parent_namespaces;
7871 elog(
ERROR,
"failed to find plan for subquery %s",
7875 elog(
ERROR,
"bogus varattno for subquery var: %d",
7877 Assert(netlevelsup == 0);
7891 elog(
ERROR,
"cannot decompile join alias var in plan tree");
7929 foreach(lc, ctedpns->
ctes)
7942 if (ste == NULL || ste->resjunk)
7943 elog(
ERROR,
"CTE %s does not have attribute %d",
7945 expr = (
Node *) ste->expr;
7956 List *parent_namespaces;
7993 elog(
ERROR,
"failed to find plan for CTE %s",
7997 elog(
ERROR,
"bogus varattno for subquery var: %d",
7999 Assert(netlevelsup == 0);
8018 Assert(fieldno >= 1 && fieldno <= tupleDesc->natts);
8036 *ancestor_cell_p = NULL;
8050 child_plan = dpns->
plan;
8073 *ancestor_cell_p = lc;
8093 if (paramid == param->
paramid)
8111 *ancestor_cell_p = rest;
8115 elog(
ERROR,
"SubPlan cannot be outermost ancestor");
8129 child_plan = (
Plan *) ancestor;
8158 bool save_varprefix;
8176 need_paren = !(
IsA(expr,
Var) ||
8210 bool should_qualify =
false;
8225 should_qualify =
true;
8266 if (strlen(op) == 1)
8290 case T_CoerceToDomainValue:
8291 case T_SetToDefault:
8292 case T_CurrentOfExpr:
8296 case T_SubscriptingRef:
8299 case T_CoalesceExpr:
8301 case T_SQLValueFunction:
8303 case T_NextValueExpr:
8306 case T_GroupingFunc:
8308 case T_MergeSupportFunc:
8310 case T_JsonConstructorExpr:
8333 case T_CoerceToDomain:
8343 case T_ArrayCoerceExpr:
8346 case T_ConvertRowtypeExpr:
8356 const char *parentOp;
8359 bool is_lopriparent;
8360 bool is_hipriparent;
8367 is_lopriop = (strchr(
"+-", *op) != NULL);
8368 is_hipriop = (strchr(
"*/%", *op) != NULL);
8369 if (!(is_lopriop || is_hipriop))
8376 is_lopriparent = (strchr(
"+-", *parentOp) != NULL);
8377 is_hipriparent = (strchr(
"*/%", *parentOp) != NULL);
8378 if (!(is_lopriparent || is_hipriparent))
8381 if (is_hipriop && is_lopriparent)
8384 if (is_lopriop && is_hipriparent)
8403 case T_DistinctExpr:
8404 case T_JsonIsPredicate:
8419 case T_SubscriptingRef:
8422 case T_CoalesceExpr:
8427 case T_GroupingFunc:
8445 parentType = ((
BoolExpr *) parentNode)->boolop;
8471 case T_SubscriptingRef:
8474 case T_CoalesceExpr:
8479 case T_GroupingFunc:
8487 case T_JsonValueExpr:
8508 int indentBefore,
int indentAfter,
int indentPlus)
8541 indentAmount += indentPlus;
8563 while (
str->len > 0 &&
str->data[
str->len - 1] ==
' ')
8564 str->data[--(
str->len)] =
'\0';
8581 bool showimplicit,
Node *parentNode)
8649 case T_GroupingFunc:
8663 case T_MergeSupportFunc:
8667 case T_SubscriptingRef:
8684 context, showimplicit);
8737 case T_NamedArgExpr:
8750 case T_DistinctExpr:
8777 case T_ScalarArrayOpExpr:
8791 expr->
useOr ?
"ANY" :
"ALL");
8893 case T_AlternativeSubPlan:
8909 if (
splan->useHashTable)
8925 const char *fieldname;
8999 relabel->resulttypmod,
9026 case T_ArrayCoerceExpr:
9041 acoerce->resulttypmod,
9047 case T_ConvertRowtypeExpr:
9094 foreach(temp, caseexpr->
args)
9144 case T_CaseTestExpr:
9189 if (rowexpr->row_typeid != RECORDOID)
9206 if (tupdesc == NULL ||
9216 if (tupdesc != NULL)
9218 while (i < tupdesc->natts)
9238 case T_RowCompareExpr:
9267 case T_CoalesceExpr:
9281 switch (minmaxexpr->
op)
9295 case T_SQLValueFunction:
9359 bool needcomma =
false;
9448 Assert(!con->constisnull);
9451 " PRESERVE WHITESPACE");
9454 " STRIP WHITESPACE");
9471 if (con->constisnull)
9479 ", STANDALONE YES");
9487 ", STANDALONE NO VALUE");
9524 if (ntest->argisrow ||
9536 elog(
ERROR,
"unrecognized nulltesttype: %d",
9551 elog(
ERROR,
"unrecognized nulltesttype: %d",
9588 elog(
ERROR,
"unrecognized booltesttype: %d",
9596 case T_CoerceToDomain:
9611 ctest->resulttypmod,
9617 case T_CoerceToDomainValue:
9621 case T_SetToDefault:
9625 case T_CurrentOfExpr:
9638 case T_NextValueExpr:
9654 case T_InferenceElem:
9657 bool save_varprefix;
9675 need_parens =
false;
9701 case T_PartitionBoundSpec:
9753 elog(
ERROR,
"unrecognized partition strategy: %d",
9760 case T_JsonValueExpr:
9769 case T_JsonConstructorExpr:
9773 case T_JsonIsPredicate:
9815 foreach(l, (
List *) node)
9849 if (node &&
IsA(node,
Var))
9928 case T_CoalesceExpr:
9930 case T_SQLValueFunction:
10003 false, (
Node *) expr);
10015 Oid rettype = expr->funcresulttype;
10016 int32 coercedTypmod;
10022 rettype, coercedTypmod,
10045 (
errcode(ERRCODE_TOO_MANY_ARGUMENTS),
10046 errmsg(
"too many arguments")));
10049 foreach(l, expr->
args)
10061 argnames, argtypes,
10062 expr->funcvariadic,
10066 foreach(l, expr->
args)
10070 if (use_variadic &&
lnext(expr->
args, l) == NULL)
10082 Aggref *original_aggref)
10095 const char *
options,
bool is_json_objectagg)
10100 bool use_variadic =
false;
10132 argtypes, aggref->aggvariadic,
10140 if (AGGKIND_IS_ORDERED_SET(aggref->aggkind))
10147 Assert(!aggref->aggvariadic);
10156 if (aggref->aggstar)
10164 foreach(l, aggref->
args)
10174 if (is_json_objectagg)
10188 if (use_variadic &&
i == nargs)
10222 Aggref *original_aggref = callback_arg;
10225 elog(
ERROR,
"combining Aggref does not point to an Aggref");
10227 aggref = (
Aggref *) node;
10248 bool is_json_objectagg)
10258 (
errcode(ERRCODE_TOO_MANY_ARGUMENTS),
10259 errmsg(
"too many arguments")));
10262 foreach(l, wfunc->
args)
10274 argtypes,
false, NULL,
10280 if (wfunc->winstar)
10284 if (is_json_objectagg)
10321 elog(
ERROR,
"could not find window clause for winref %u",
10346 case F_TIMEZONE_INTERVAL_TIMESTAMP:
10347 case F_TIMEZONE_INTERVAL_TIMESTAMPTZ:
10348 case F_TIMEZONE_INTERVAL_TIMETZ:
10349 case F_TIMEZONE_TEXT_TIMESTAMP:
10350 case F_TIMEZONE_TEXT_TIMESTAMPTZ:
10351 case F_TIMEZONE_TEXT_TIMETZ:
10362 case F_TIMEZONE_TIMESTAMP:
10363 case F_TIMEZONE_TIMESTAMPTZ:
10364 case F_TIMEZONE_TIMETZ:
10372 case F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_INTERVAL:
10373 case F_OVERLAPS_TIMESTAMPTZ_INTERVAL_TIMESTAMPTZ_TIMESTAMPTZ:
10374 case F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_INTERVAL:
10375 case F_OVERLAPS_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ_TIMESTAMPTZ:
10376 case F_OVERLAPS_TIMESTAMP_INTERVAL_TIMESTAMP_INTERVAL:
10377 case F_OVERLAPS_TIMESTAMP_INTERVAL_TIMESTAMP_TIMESTAMP:
10378 case F_OVERLAPS_TIMESTAMP_TIMESTAMP_TIMESTAMP_INTERVAL:
10379 case F_OVERLAPS_TIMESTAMP_TIMESTAMP_TIMESTAMP_TIMESTAMP:
10380 case F_OVERLAPS_TIMETZ_TIMETZ_TIMETZ_TIMETZ:
10381 case F_OVERLAPS_TIME_INTERVAL_TIME_INTERVAL:
10382 case F_OVERLAPS_TIME_INTERVAL_TIME_TIME:
10383 case F_OVERLAPS_TIME_TIME_TIME_INTERVAL:
10384 case F_OVERLAPS_TIME_TIME_TIME_TIME:
10397 case F_EXTRACT_TEXT_DATE:
10398 case F_EXTRACT_TEXT_TIME:
10399 case F_EXTRACT_TEXT_TIMETZ:
10400 case F_EXTRACT_TEXT_TIMESTAMP:
10401 case F_EXTRACT_TEXT_TIMESTAMPTZ:
10402 case F_EXTRACT_TEXT_INTERVAL:
10410 !con->constisnull);
10418 case F_IS_NORMALIZED:
10430 !con->constisnull);
10437 case F_PG_COLLATION_FOR:
10454 !con->constisnull);
10461 case F_OVERLAY_BIT_BIT_INT4:
10462 case F_OVERLAY_BIT_BIT_INT4_INT4:
10463 case F_OVERLAY_BYTEA_BYTEA_INT4:
10464 case F_OVERLAY_BYTEA_BYTEA_INT4_INT4:
10465 case F_OVERLAY_TEXT_TEXT_INT4:
10466 case F_OVERLAY_TEXT_TEXT_INT4_INT4:
10482 case F_POSITION_BIT_BIT:
10483 case F_POSITION_BYTEA_BYTEA:
10484 case F_POSITION_TEXT_TEXT:
10493 case F_SUBSTRING_BIT_INT4:
10494 case F_SUBSTRING_BIT_INT4_INT4:
10495 case F_SUBSTRING_BYTEA_INT4:
10496 case F_SUBSTRING_BYTEA_INT4_INT4:
10497 case F_SUBSTRING_TEXT_INT4:
10498 case F_SUBSTRING_TEXT_INT4_INT4:
10512 case F_SUBSTRING_TEXT_TEXT_TEXT:
10523 case F_BTRIM_BYTEA_BYTEA:
10525 case F_BTRIM_TEXT_TEXT:
10538 case F_LTRIM_BYTEA_BYTEA:
10540 case F_LTRIM_TEXT_TEXT:
10553 case F_RTRIM_BYTEA_BYTEA:
10555 case F_RTRIM_TEXT_TEXT:
10568 case F_SYSTEM_USER:
10592 Oid resulttype,
int32 resulttypmod,
10613 ((
Const *)
arg)->consttype == resulttype &&
10614 ((
Const *)
arg)->consttypmod == -1)
10661 bool needlabel =
false;
10663 if (constval->constisnull)
10674 constval->consttypmod));
10681 &typoutput, &typIsVarlena);
10698 if (extval[0] !=
'-')
10714 if (isdigit((
unsigned char) extval[0]) &&
10715 strcspn(extval,
"eE.") != strlen(extval))
10727 if (strcmp(extval,
"t") == 0)
10767 needlabel |= (constval->consttypmod >= 0);
10773 if (needlabel || showtype > 0)
10776 constval->consttypmod));
10793 if (constval->constcollid != typcollation)
10812 " FORMAT JSONB" :
" FORMAT JSON");
10831 bool json_format_by_default)
10840 if (!json_format_by_default ||
10855 bool is_json_object;
10870 switch (ctor->
type)
10894 foreach(lc, ctor->
args)
10901 sep = (is_json_object && (curridx % 2) != 0) ?
" : " :
", ";
10947 const char *
funcname,
bool is_json_objectagg)
10961 is_json_objectagg);
10963 elog(
ERROR,
"invalid JsonConstructorExpr underlying node type: %d",
10973 const char *valptr;
10981 for (valptr =
val; *valptr; valptr++)
11002 char *opname = NULL;
11064 elog(
ERROR,
"unrecognized testexpr type: %d",
11077 if (strcmp(opname,
"=") == 0)
11094 need_paren =
false;
11099 elog(
ERROR,
"unrecognized sublink type: %d",
11131 if (tf->ns_uris !=
NIL)
11138 forboth(lc1, tf->ns_uris, lc2, tf->ns_names)
11148 if (ns_node != NULL)
11178 forfive(l1, tf->colnames, l2, tf->coltypes, l3, tf->coltypmods,
11179 l4, tf->
colexprs, l5, tf->coldefexprs)
11186 bool ordinality = (tf->ordinalitycol == colnum);
11194 ordinality ?
"FOR ORDINALITY" :
11199 if (coldefexpr != NULL)
11205 if (colexpr != NULL)
11273 context->
buf = &itembuf;
11284 if (itembuf.
len > 0 && itembuf.
data[0] ==
'\n')
11295 trailing_nl = strrchr(
buf->data,
'\n');
11296 if (trailing_nl == NULL)
11297 trailing_nl =
buf->data;
11305 if (strlen(trailing_nl) + itembuf.
len > context->
wrapColumn)
11398 rtfunc->funccolnames !=
NIL)
11400 all_unnest =
false;
11433 if (rtfunc->funccolnames !=
NIL)
11472 if (rtfunc1 && rtfunc1->funccolnames !=
NIL)
11491 bool need_paren_on_right;
11502 switch (
j->jointype)
11535 elog(
ERROR,
"unrecognized join type: %d",
11536 (
int)
j->jointype);
11539 if (need_paren_on_right)
11542 if (need_paren_on_right)
11545 if (
j->usingClause)
11554 char *colname = (
char *)
lfirst(lc);
11564 if (
j->join_using_alias)
11587 if (
j->alias != NULL)
11603 elog(
ERROR,
"unrecognized node type: %d",
11619 bool printalias =
false;
11621 if (rte->
alias != NULL)
11668 if (strcmp(refname, rte->
ctename) != 0)
11674 use_as ?
" AS " :
" ",
11738 forfour(l1, rtfunc->funccoltypes,
11739 l2, rtfunc->funccoltypmods,
11740 l3, rtfunc->funccolcollations,
11741 l4, rtfunc->funccolnames)
11786 argtypes[0] = INTERNALOID;
11793 foreach(l, tablesample->
args)
11829 elog(
ERROR,
"cache lookup failed for opclass %u", opclass);
11836 opcname =
NameStr(opcrec->opcname);
11864 return &
buf.data[1];
11897 elog(
ERROR,
"argument type %s of FieldStore is not a tuple type",
11938 node = (
Node *) cdomain->
arg;
11950 if (cdomain && node == (
Node *) cdomain->
arg)
11951 node = (
Node *) cdomain;
12006 for (ptr =
ident; *ptr; ptr++)
12010 if ((ch >=
'a' && ch <=
'z') ||
12011 (ch >=
'0' && ch <=
'9') ||
12046 result = (
char *)
palloc(strlen(
ident) + nquotes + 2 + 1);
12050 for (ptr =
ident; *ptr; ptr++)
12096 elog(
ERROR,
"cache lookup failed for relation %u", relid);
12123 elog(
ERROR,
"cache lookup failed for relation %u", relid);
12129 foreach(nslist, namespaces)
12134 foreach(ctlist, dpns->
ctes)
12181 elog(
ERROR,
"cache lookup failed for relation %u", relid);
12187 elog(
ERROR,
"cache lookup failed for namespace %u",
12188 reltup->relnamespace);
12214 bool has_variadic,
bool *use_variadic_p,
12229 Oid *p_true_typeids;
12230 bool force_qualify =
false;
12234 elog(
ERROR,
"cache lookup failed for function %u", funcid);
12244 if (strcmp(
proname,
"cube") == 0 || strcmp(
proname,
"rollup") == 0)
12245 force_qualify =
true;
12258 if (use_variadic_p)
12262 use_variadic = has_variadic;
12263 *use_variadic_p = use_variadic;
12268 use_variadic =
false;
12278 if (!force_qualify)
12280 NIL, argnames, nargs, argtypes,
12281 !use_variadic,
true,
false,
12282 &p_funcid, &p_rettype,
12283 &p_retset, &p_nvargs, &p_vatype,
12284 &p_true_typeids, NULL);
12294 p_funcid == funcid)
12331 elog(
ERROR,
"cache lookup failed for operator %u", operid);
12333 oprname =
NameStr(operform->oprname);
12340 switch (operform->oprkind)
12351 elog(
ERROR,
"unrecognized oprkind: %d", operform->oprkind);
12356 if (p_result != NULL &&
oprid(p_result) == operid)
12369 if (p_result != NULL)
12396 const char *leftop,
Oid leftoptype,
12398 const char *rightop,
Oid rightoptype)
12407 elog(
ERROR,
"cache lookup failed for operator %u", opoid);
12409 Assert(operform->oprkind ==
'b');
12410 oprname =
NameStr(operform->oprname);
12415 if (leftoptype != operform->oprleft)
12420 if (rightoptype != operform->oprright)
12444 elog(
ERROR,
"cache lookup failed for type %u", typid);
12476 elog(
ERROR,
"cache lookup failed for type %u", typid);
12482 elog(
ERROR,
"cache lookup failed for namespace %u",
12483 typtup->typnamespace);
12511 collname =
NameStr(colltup->collname);
12601 char *result = NULL;
12608 elog(
ERROR,
"cache lookup failed for relation %u", relid);
12611 Anum_pg_class_reloptions, &isnull);
12644 foreach(cell, bound_datums)
IndexAmRoutine * GetIndexAmRoutine(Oid amhandler)
#define DatumGetArrayTypeP(X)
ArrayBuildState * accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext)
Datum array_ref(ArrayType *array, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
void deconstruct_array_builtin(ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
Datum makeArrayResult(ArrayBuildState *astate, MemoryContext rcontext)
#define InvalidAttrNumber
char * get_tablespace_name(Oid spc_oid)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_make_singleton(int x)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
#define TextDatumGetCString(d)
#define SQL_STR_DOUBLE(ch, escape_backslash)
#define OidIsValid(objectId)
const uint8 ScanKeywordCategories[SCANKEYWORDS_NUM_KEYWORDS]
static void PGresult * res
void hash_destroy(HTAB *hashp)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define palloc0_array(type, count)
char * OidOutputFunctionCall(Oid functionId, Datum val)
#define PG_GETARG_TEXT_PP(n)
#define DatumGetByteaPP(X)
#define DirectFunctionCall1(func, arg1)
#define PG_RETURN_TEXT_P(x)
#define PG_RETURN_NAME(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_DATUM(x)
int get_func_trftypes(HeapTuple procTup, Oid **p_trftypes)
int get_func_arg_info(HeapTuple procTup, Oid **p_argtypes, char ***p_argnames, char **p_argmodes)
TupleDesc get_expr_result_tupdesc(Node *expr, bool noError)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
int GetConfigOptionFlags(const char *name, bool missing_ok)
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
#define HeapTupleIsValid(tuple)
static Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
if(TABLE==NULL||TABLE_index==NULL)
PGDLLIMPORT const ScanKeywordList ScanKeywords
#define UNRESERVED_KEYWORD
int ScanKeywordLookup(const char *str, const ScanKeywordList *keywords)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * lappend(List *list, void *datum)
List * list_copy(const List *oldlist)
List * list_delete_first(List *list)
void list_free(List *list)
List * list_copy_tail(const List *oldlist, int nskip)
List * list_concat(List *list1, const List *list2)
List * lcons(void *datum, List *list)
char * get_language_name(Oid langoid, bool missing_ok)
AttrNumber get_attnum(Oid relid, const char *attname)
Oid get_opclass_input_type(Oid opclass)
char * get_namespace_name_or_temp(Oid nspid)
bool type_is_rowtype(Oid typid)
char * get_namespace_name(Oid nspid)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
Datum get_attoptions(Oid relid, int16 attnum)
char get_rel_relkind(Oid relid)
Oid get_typcollation(Oid typid)
char * get_rel_name(Oid relid)
char * get_constraint_name(Oid conoid)
Oid get_rel_tablespace(Oid relid)
Oid get_typ_typrelid(Oid typid)
Oid get_base_element_type(Oid typid)
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid)
Alias * makeAlias(const char *aliasname, List *colnames)
int pg_mbcliplen(const char *mbstr, int len, int limit)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
MemoryContext CurrentMemoryContext
#define CHECK_FOR_INTERRUPTS()
Datum namein(PG_FUNCTION_ARGS)
bool CollationIsVisible(Oid collid)
bool RelationIsVisible(Oid relid)
bool OpclassIsVisible(Oid opcid)
RangeVar * makeRangeVarFromNameList(const List *names)
#define RangeVarGetRelid(relation, lockmode, missing_ok)
Oid exprType(const Node *expr)
bool exprIsLengthCoercion(const Node *expr, int32 *coercedTypmod)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
Node * strip_implicit_coercions(Node *node)
#define DO_AGGSPLIT_SKIPFINAL(as)
#define IsA(nodeptr, _type_)
#define DO_AGGSPLIT_COMBINE(as)
#define castNode(_type_, nodeptr)
#define repalloc0_array(pointer, type, oldcount, count)
int get_aggregate_argtypes(Aggref *aggref, Oid *inputTypes)
FuncDetailCode func_get_detail(List *funcname, List *fargs, List *fargnames, int nargs, Oid *argtypes, bool expand_variadic, bool expand_defaults, bool include_out_arguments, Oid *funcid, Oid *rettype, bool *retset, int *nvargs, Oid *vatype, Oid **true_typeids, List **argdefaults)
Operator left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
Operator oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
char * get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
#define FRAMEOPTION_END_CURRENT_ROW
#define FRAMEOPTION_END_OFFSET
#define FRAMEOPTION_EXCLUDE_CURRENT_ROW
#define FKCONSTR_ACTION_RESTRICT
#define FRAMEOPTION_END_OFFSET_PRECEDING
#define FRAMEOPTION_START_UNBOUNDED_PRECEDING
#define GetCTETargetList(cte)
#define FKCONSTR_ACTION_SETDEFAULT
@ PARTITION_STRATEGY_HASH
@ PARTITION_STRATEGY_LIST
@ PARTITION_STRATEGY_RANGE
#define FRAMEOPTION_START_CURRENT_ROW
#define FKCONSTR_MATCH_SIMPLE
#define FRAMEOPTION_START_OFFSET
@ PARTITION_RANGE_DATUM_MAXVALUE
@ PARTITION_RANGE_DATUM_MINVALUE
#define FKCONSTR_MATCH_PARTIAL
#define FRAMEOPTION_END_OFFSET_FOLLOWING
#define FRAMEOPTION_EXCLUDE_TIES
#define FRAMEOPTION_RANGE
#define FRAMEOPTION_EXCLUDE_GROUP
#define FKCONSTR_ACTION_CASCADE
#define FRAMEOPTION_GROUPS
#define FRAMEOPTION_BETWEEN
#define FKCONSTR_ACTION_SETNULL
#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING
#define FRAMEOPTION_START_OFFSET_PRECEDING
#define FRAMEOPTION_START_OFFSET_FOLLOWING
#define FRAMEOPTION_NONDEFAULT
#define FKCONSTR_MATCH_FULL
#define FKCONSTR_ACTION_NOACTION
PGDLLIMPORT bool standard_conforming_strings
#define rt_fetch(rangetable_index, rangetable)
Expr * get_partition_qual_relid(Oid relid)
FormData_pg_aggregate * Form_pg_aggregate
FormData_pg_am * Form_pg_am
FormData_pg_attribute * Form_pg_attribute
FormData_pg_authid * Form_pg_authid
FormData_pg_class * Form_pg_class
FormData_pg_collation * Form_pg_collation
AttrNumber extractNotNullColumn(HeapTuple constrTup)
FormData_pg_constraint * Form_pg_constraint
FormData_pg_depend * Form_pg_depend
FormData_pg_index * Form_pg_index
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define linitial_node(type, l)
#define lsecond_node(type, l)
#define forboth(cell1, list1, cell2, list2)
#define foreach_current_index(var_or_cell)
#define for_each_cell(cell, lst, initcell)
static ListCell * list_head(const List *l)
#define for_each_from(cell, lst, N)
#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4)
static void * list_nth(const List *list, int n)
static ListCell * lnext(const List *l, const ListCell *c)
#define forfive(cell1, list1, cell2, list2, cell3, list3, cell4, list4, cell5, list5)
#define list_make2(x1, x2)
static int list_cell_number(const List *l, const ListCell *c)
#define lthird_node(type, l)
FormData_pg_opclass * Form_pg_opclass
FormData_pg_operator * Form_pg_operator
FormData_pg_partitioned_table * Form_pg_partitioned_table
FormData_pg_proc * Form_pg_proc
FormData_pg_statistic_ext * Form_pg_statistic_ext
FormData_pg_trigger * Form_pg_trigger
FormData_pg_type * Form_pg_type
void check_stack_depth(void)
static bool DatumGetBool(Datum X)
static Datum PointerGetDatum(const void *X)
static Name DatumGetName(Datum X)
static Oid DatumGetObjectId(Datum X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
static char DatumGetChar(Datum X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
static int16 DatumGetInt16(Datum X)
static int32 DatumGetInt32(Datum X)
@ SVFOP_CURRENT_TIMESTAMP
@ SVFOP_CURRENT_TIMESTAMP_N
@ OVERRIDING_SYSTEM_VALUE
void * stringToNode(const char *str)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
void AcquireRewriteLocks(Query *parsetree, bool forExecute, bool forUpdatePushedDown)
Query * getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
#define ViewSelectRuleName
Datum pg_get_triggerdef_ext(PG_FUNCTION_ARGS)
static void make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, int prettyFlags, int wrapColumn)
static void removeStringInfoSpaces(StringInfo str)
static bool looks_like_function(Node *node)
Datum pg_get_partition_constraintdef(PG_FUNCTION_ARGS)
static char * get_rtable_name(int rtindex, deparse_context *context)
Datum pg_get_viewdef_wrap(PG_FUNCTION_ARGS)
static void set_relation_column_names(deparse_namespace *dpns, RangeTblEntry *rte, deparse_columns *colinfo)
static void appendContextKeyword(deparse_context *context, const char *str, int indentBefore, int indentAfter, int indentPlus)
Datum pg_get_indexdef_ext(PG_FUNCTION_ARGS)
static void set_using_names(deparse_namespace *dpns, Node *jtnode, List *parentUsing)
static Plan * find_recursive_union(deparse_namespace *dpns, WorkTableScan *wtscan)
static text * string_to_text(char *str)
static void get_values_def(List *values_lists, deparse_context *context)
char * deparse_expression(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit)
#define PRETTYINDENT_LIMIT
Datum pg_get_viewdef(PG_FUNCTION_ARGS)
static char * make_colname_unique(char *colname, deparse_namespace *dpns, deparse_columns *colinfo)
static const char * get_simple_binary_op_name(OpExpr *expr)
static void get_json_agg_constructor(JsonConstructorExpr *ctor, deparse_context *context, const char *funcname, bool is_json_objectagg)
Datum pg_get_constraintdef(PG_FUNCTION_ARGS)
static void set_deparse_for_query(deparse_namespace *dpns, Query *query, List *parent_namespaces)
static void print_function_trftypes(StringInfo buf, HeapTuple proctup)
void(* rsv_callback)(Node *node, deparse_context *context, void *callback_arg)
char * pg_get_constraintdef_command(Oid constraintId)
#define PRETTYINDENT_JOIN
static bool is_input_argument(int nth, const char *argmodes)
static void get_query_def(Query *query, StringInfo buf, List *parentnamespace, TupleDesc resultDesc, bool colNamesVisible, int prettyFlags, int wrapColumn, int startIndent)
static void get_tablesample_def(TableSampleClause *tablesample, deparse_context *context)
Datum pg_get_functiondef(PG_FUNCTION_ARGS)
Datum pg_get_function_result(PG_FUNCTION_ARGS)
const char * quote_identifier(const char *ident)
Datum pg_get_indexdef(PG_FUNCTION_ARGS)
static void get_sublink_expr(SubLink *sublink, deparse_context *context)
static void get_rte_alias(RangeTblEntry *rte, int varno, bool use_as, deparse_context *context)
Datum pg_get_function_arg_default(PG_FUNCTION_ARGS)
char * generate_opclass_name(Oid opclass)
static void get_parameter(Param *param, deparse_context *context)
Datum pg_get_statisticsobjdef_expressions(PG_FUNCTION_ARGS)
Datum pg_get_ruledef(PG_FUNCTION_ARGS)
#define PRETTYFLAG_INDENT
List * deparse_context_for(const char *aliasname, Oid relid)
static void get_column_alias_list(deparse_columns *colinfo, deparse_context *context)
Datum pg_get_statisticsobjdef_columns(PG_FUNCTION_ARGS)
Datum pg_get_statisticsobjdef(PG_FUNCTION_ARGS)
static void simple_quote_literal(StringInfo buf, const char *val)
static bool colname_is_unique(const char *colname, deparse_namespace *dpns, deparse_columns *colinfo)
static void get_from_clause_coldeflist(RangeTblFunction *rtfunc, deparse_columns *colinfo, deparse_context *context)
static void get_from_clause(Query *query, const char *prefix, deparse_context *context)
static void get_basic_select_query(Query *query, deparse_context *context, TupleDesc resultDesc, bool colNamesVisible)
static bool get_func_sql_syntax(FuncExpr *expr, deparse_context *context)
static void get_target_list(List *targetList, deparse_context *context, TupleDesc resultDesc, bool colNamesVisible)
Datum pg_get_partkeydef(PG_FUNCTION_ARGS)
static char * generate_qualified_relation_name(Oid relid)
static void set_simple_column_names(deparse_namespace *dpns)
#define PRETTY_INDENT(context)
static void get_rule_groupingset(GroupingSet *gset, List *targetlist, bool omit_parens, deparse_context *context)
static char * pg_get_indexdef_worker(Oid indexrelid, int colno, const Oid *excludeOps, bool attrsOnly, bool keysOnly, bool showTblSpc, bool inherits, int prettyFlags, bool missing_ok)
static char * pg_get_constraintdef_worker(Oid constraintId, bool fullCommand, int prettyFlags, bool missing_ok)
static void get_rule_expr_funccall(Node *node, deparse_context *context, bool showimplicit)
static void expand_colnames_array_to(deparse_columns *colinfo, int n)
static void add_cast_to(StringInfo buf, Oid typid)
static void get_special_variable(Node *node, deparse_context *context, void *callback_arg)
static void get_select_query_def(Query *query, deparse_context *context, TupleDesc resultDesc, bool colNamesVisible)
static void get_windowfunc_expr_helper(WindowFunc *wfunc, deparse_context *context, const char *funcname, const char *options, bool is_json_objectagg)
static void get_rule_list_toplevel(List *lst, deparse_context *context, bool showimplicit)
char * pg_get_statisticsobjdef_string(Oid statextid)
static char * pg_get_statisticsobj_worker(Oid statextid, bool columns_only, bool missing_ok)
#define deparse_columns_fetch(rangetable_index, dpns)
static void get_json_constructor(JsonConstructorExpr *ctor, deparse_context *context, bool showimplicit)
static const char *const query_getrulebyoid
static char * generate_function_name(Oid funcid, int nargs, List *argnames, Oid *argtypes, bool has_variadic, bool *use_variadic_p, ParseExprKind special_exprkind)
static void printSubscripts(SubscriptingRef *sbsref, deparse_context *context)
static void pop_ancestor_plan(deparse_namespace *dpns, deparse_namespace *save_dpns)
char * generate_collation_name(Oid collid)
static void get_rule_expr_paren(Node *node, deparse_context *context, bool showimplicit, Node *parentNode)
bool quote_all_identifiers
static void get_agg_expr(Aggref *aggref, deparse_context *context, Aggref *original_aggref)
static int decompile_column_index_array(Datum column_index_array, Oid relId, StringInfo buf)
static void get_const_collation(Const *constval, deparse_context *context)
static void get_delete_query_def(Query *query, deparse_context *context, bool colNamesVisible)
static SPIPlanPtr plan_getrulebyoid
static char * deparse_expression_pretty(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit, int prettyFlags, int startIndent)
Datum pg_get_ruledef_ext(PG_FUNCTION_ARGS)
static void print_function_sqlbody(StringInfo buf, HeapTuple proctup)
static bool has_dangerous_join_using(deparse_namespace *dpns, Node *jtnode)
static Node * get_rule_sortgroupclause(Index ref, List *tlist, bool force_colno, deparse_context *context)
List * select_rtable_names_for_explain(List *rtable, Bitmapset *rels_used)
char * pg_get_partconstrdef_string(Oid partitionId, char *aliasname)
char * quote_qualified_identifier(const char *qualifier, const char *ident)
static char * pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn)
static void push_ancestor_plan(deparse_namespace *dpns, ListCell *ancestor_cell, deparse_namespace *save_dpns)
static SPIPlanPtr plan_getviewrule
char * pg_get_partkeydef_columns(Oid relid, bool pretty)
#define WRAP_COLUMN_DEFAULT
static char * flatten_reloptions(Oid relid)
static text * pg_get_expr_worker(text *expr, Oid relid, int prettyFlags)
List * set_deparse_context_plan(List *dpcontext, Plan *plan, List *ancestors)
static Node * processIndirection(Node *node, deparse_context *context)
static void get_agg_combine_expr(Node *node, deparse_context *context, void *callback_arg)
#define PRETTY_PAREN(context)
Datum pg_get_triggerdef(PG_FUNCTION_ARGS)
Datum pg_get_function_sqlbody(PG_FUNCTION_ARGS)
Datum pg_get_expr(PG_FUNCTION_ARGS)
static char * generate_qualified_type_name(Oid typid)
char * pg_get_indexdef_columns_extended(Oid indexrelid, bits16 flags)
static void get_utility_query_def(Query *query, deparse_context *context)
static char * get_relation_name(Oid relid)
Datum pg_get_expr_ext(PG_FUNCTION_ARGS)
static void get_rule_windowclause(Query *query, deparse_context *context)
static void get_rule_windowspec(WindowClause *wc, List *targetList, deparse_context *context)
static void get_json_returning(JsonReturning *returning, StringInfo buf, bool json_format_by_default)
Datum pg_get_viewdef_name_ext(PG_FUNCTION_ARGS)
static Node * find_param_referent(Param *param, deparse_context *context, deparse_namespace **dpns_p, ListCell **ancestor_cell_p)
static void get_rule_orderby(List *orderList, List *targetList, bool force_colno, deparse_context *context)
static void pop_child_plan(deparse_namespace *dpns, deparse_namespace *save_dpns)
static const char * get_name_for_var_field(Var *var, int fieldno, int levelsup, deparse_context *context)
static void set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte, deparse_columns *colinfo)
Datum pg_get_constraintdef_ext(PG_FUNCTION_ARGS)
static void set_rtable_names(deparse_namespace *dpns, List *parent_namespaces, Bitmapset *rels_used)
static void get_update_query_targetlist_def(Query *query, List *targetList, deparse_context *context, RangeTblEntry *rte)
static void get_rule_expr(Node *node, deparse_context *context, bool showimplicit)
Datum pg_get_viewdef_ext(PG_FUNCTION_ARGS)
static char * pg_get_partkeydef_worker(Oid relid, int prettyFlags, bool attrsOnly, bool missing_ok)
static void get_oper_expr(OpExpr *expr, deparse_context *context)
char * pg_get_querydef(Query *query, bool pretty)
Datum pg_get_function_identity_arguments(PG_FUNCTION_ARGS)
static char * pg_get_triggerdef_worker(Oid trigid, bool pretty)
#define GET_PRETTY_FLAGS(pretty)
static void get_reloptions(StringInfo buf, Datum reloptions)
static void get_func_expr(FuncExpr *expr, deparse_context *context, bool showimplicit)
static void get_const_expr(Const *constval, deparse_context *context, int showtype)
void generate_operator_clause(StringInfo buf, const char *leftop, Oid leftoptype, Oid opoid, const char *rightop, Oid rightoptype)
static void get_setop_query(Node *setOp, Query *query, deparse_context *context, TupleDesc resultDesc, bool colNamesVisible)
static void make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, int prettyFlags)
static const char *const query_getviewrule
static char * pg_get_ruledef_worker(Oid ruleoid, int prettyFlags)
static int print_function_arguments(StringInfo buf, HeapTuple proctup, bool print_table_args, bool print_defaults)
static void identify_join_columns(JoinExpr *j, RangeTblEntry *jrte, deparse_columns *colinfo)
char * pg_get_indexdef_columns(Oid indexrelid, bool pretty)
static void print_function_rettype(StringInfo buf, HeapTuple proctup)
static RangeTblEntry * get_simple_values_rte(Query *query, TupleDesc resultDesc)
static void set_deparse_plan(deparse_namespace *dpns, Plan *plan)
static void resolve_special_varno(Node *node, deparse_context *context, rsv_callback callback, void *callback_arg)
static void get_merge_query_def(Query *query, deparse_context *context, bool colNamesVisible)
static void get_json_format(JsonFormat *format, StringInfo buf)
static void get_insert_query_def(Query *query, deparse_context *context, bool colNamesVisible)
static void get_tablefunc(TableFunc *tf, deparse_context *context, bool showimplicit)
static void get_rule_expr_toplevel(Node *node, deparse_context *context, bool showimplicit)
static void get_coercion_expr(Node *arg, deparse_context *context, Oid resulttype, int32 resulttypmod, Node *parentNode)
static void push_child_plan(deparse_namespace *dpns, Plan *plan, deparse_namespace *save_dpns)
static void get_json_constructor_options(JsonConstructorExpr *ctor, StringInfo buf)
char * get_range_partbound_string(List *bound_datums)
static bool isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
static void get_with_clause(Query *query, deparse_context *context)
char * pg_get_indexdef_string(Oid indexrelid)
List * deparse_context_for_plan_tree(PlannedStmt *pstmt, List *rtable_names)
static void get_update_query_def(Query *query, deparse_context *context, bool colNamesVisible)
static char * generate_relation_name(Oid relid, List *namespaces)
static void get_windowfunc_expr(WindowFunc *wfunc, deparse_context *context)
static char * get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context)
Datum pg_get_serial_sequence(PG_FUNCTION_ARGS)
static char * generate_operator_name(Oid operid, Oid arg1, Oid arg2)
static void get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
Datum pg_get_function_arguments(PG_FUNCTION_ARGS)
#define PRETTYFLAG_SCHEMA
static void get_opclass_name(Oid opclass, Oid actual_datatype, StringInfo buf)
Datum pg_get_viewdef_name(PG_FUNCTION_ARGS)
Datum pg_get_userbyid(PG_FUNCTION_ARGS)
static void get_agg_expr_helper(Aggref *aggref, deparse_context *context, Aggref *original_aggref, const char *funcname, const char *options, bool is_json_objectagg)
#define RULE_INDEXDEF_PRETTY
#define RULE_INDEXDEF_KEYS_ONLY
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Snapshot GetTransactionSnapshot(void)
void UnregisterSnapshot(Snapshot snapshot)
Snapshot RegisterSnapshot(Snapshot snapshot)
int SPI_fnumber(TupleDesc tupdesc, const char *fname)
SPITupleTable * SPI_tuptable
int SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, bool read_only, long tcount)
SPIPlanPtr SPI_prepare(const char *src, int nargs, Oid *argtypes)
int SPI_keepplan(SPIPlanPtr plan)
char * SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation try_relation_open(Oid relationId, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
#define BTEqualStrategyNumber
StringInfo makeStringInfo(void)
void resetStringInfo(StringInfo str)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
void appendStringInfoSpaces(StringInfo str, int count)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
BoolTestType booltesttype
CTEMaterialize ctematerialized
JsonReturning * returning
NullTestType nulltesttype
PartitionRangeDatumKind kind
OnConflictExpr * onConflict
struct TableSampleClause * tablesample
LockClauseStrength strength
LockWaitPolicy waitPolicy
Bitmapset * appendparents
ParseExprKind special_exprkind
AppendRelInfo ** appendrels
int16 values[FLEXIBLE_ARRAY_MEMBER]
Oid values[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
TargetEntry * get_sortgroupref_tle(Index sortref, List *targetList)
int count_nonjunk_tlist_entries(List *tlist)
#define ReleaseTupleDesc(tupdesc)
#define TupleDescAttr(tupdesc, i)
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
String * makeString(char *str)
Relids pull_varnos(PlannerInfo *root, Node *node)
List * textToQualifiedNameList(text *textval)
bool SplitGUCList(char *rawstring, char separator, List **namelist)
char * text_to_cstring(const text *t)
text * cstring_to_text_with_len(const char *s, int len)
text * cstring_to_text(const char *s)
char * map_xml_name_to_sql_identifier(const char *name)
@ XML_STANDALONE_NO_VALUE
static void convert(const int32 val, char *const buf)