PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#include "access/amapi.h"
#include "access/htup_details.h"
#include "access/relation.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_am.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_constraint.h"
#include "catalog/pg_depend.h"
#include "catalog/pg_language.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_partitioned_table.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_statistic_ext.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "commands/tablespace.h"
#include "common/keywords.h"
#include "executor/spi.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/pathnodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_agg.h"
#include "parser/parse_func.h"
#include "parser/parse_node.h"
#include "parser/parse_oper.h"
#include "parser/parse_relation.h"
#include "parser/parser.h"
#include "parser/parsetree.h"
#include "rewrite/rewriteHandler.h"
#include "rewrite/rewriteManip.h"
#include "rewrite/rewriteSupport.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/hsearch.h"
#include "utils/lsyscache.h"
#include "utils/partcache.h"
#include "utils/rel.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
#include "utils/varlena.h"
#include "utils/xml.h"
Go to the source code of this file.
Data Structures | |
struct | deparse_context |
struct | deparse_namespace |
struct | deparse_columns |
struct | NameHashEntry |
Macros | |
#define | PRETTYINDENT_STD 8 |
#define | PRETTYINDENT_JOIN 4 |
#define | PRETTYINDENT_VAR 4 |
#define | PRETTYINDENT_LIMIT 40 /* wrap limit */ |
#define | PRETTYFLAG_PAREN 0x0001 |
#define | PRETTYFLAG_INDENT 0x0002 |
#define | PRETTYFLAG_SCHEMA 0x0004 |
#define | GET_PRETTY_FLAGS(pretty) |
#define | WRAP_COLUMN_DEFAULT 0 |
#define | PRETTY_PAREN(context) ((context)->prettyFlags & PRETTYFLAG_PAREN) |
#define | PRETTY_INDENT(context) ((context)->prettyFlags & PRETTYFLAG_INDENT) |
#define | PRETTY_SCHEMA(context) ((context)->prettyFlags & PRETTYFLAG_SCHEMA) |
#define | deparse_columns_fetch(rangetable_index, dpns) ((deparse_columns *) list_nth((dpns)->rtable_columns, (rangetable_index)-1)) |
#define | only_marker(rte) ((rte)->inh ? "" : "ONLY ") |
Typedefs | |
typedef void(* | rsv_callback) (Node *node, deparse_context *context, void *callback_arg) |
Variables | |
static SPIPlanPtr | plan_getrulebyoid = NULL |
static const char *const | query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1" |
static SPIPlanPtr | plan_getviewrule = NULL |
static const char *const | query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2" |
bool | quote_all_identifiers = false |
#define deparse_columns_fetch | ( | rangetable_index, | |
dpns | |||
) | ((deparse_columns *) list_nth((dpns)->rtable_columns, (rangetable_index)-1)) |
Definition at line 297 of file ruleutils.c.
#define GET_PRETTY_FLAGS | ( | pretty | ) |
Definition at line 95 of file ruleutils.c.
#define only_marker | ( | rte | ) | ((rte)->inh ? "" : "ONLY ") |
Definition at line 522 of file ruleutils.c.
#define PRETTY_INDENT | ( | context | ) | ((context)->prettyFlags & PRETTYFLAG_INDENT) |
Definition at line 104 of file ruleutils.c.
#define PRETTY_PAREN | ( | context | ) | ((context)->prettyFlags & PRETTYFLAG_PAREN) |
Definition at line 103 of file ruleutils.c.
#define PRETTY_SCHEMA | ( | context | ) | ((context)->prettyFlags & PRETTYFLAG_SCHEMA) |
Definition at line 105 of file ruleutils.c.
#define PRETTYFLAG_INDENT 0x0002 |
Definition at line 91 of file ruleutils.c.
#define PRETTYFLAG_PAREN 0x0001 |
Definition at line 90 of file ruleutils.c.
#define PRETTYFLAG_SCHEMA 0x0004 |
Definition at line 92 of file ruleutils.c.
#define PRETTYINDENT_JOIN 4 |
Definition at line 84 of file ruleutils.c.
#define PRETTYINDENT_LIMIT 40 /* wrap limit */ |
Definition at line 87 of file ruleutils.c.
#define PRETTYINDENT_STD 8 |
Definition at line 83 of file ruleutils.c.
#define PRETTYINDENT_VAR 4 |
Definition at line 85 of file ruleutils.c.
#define WRAP_COLUMN_DEFAULT 0 |
Definition at line 100 of file ruleutils.c.
typedef void(* rsv_callback) (Node *node, deparse_context *context, void *callback_arg) |
Definition at line 310 of file ruleutils.c.
|
static |
Definition at line 12413 of file ruleutils.c.
References appendStringInfo(), buf, elog(), ERROR, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), quote_identifier(), ReleaseSysCache(), SearchSysCache1(), TYPEOID, and typname.
Referenced by generate_operator_clause().
|
static |
Definition at line 8499 of file ruleutils.c.
References appendStringInfoChar(), appendStringInfoSpaces(), appendStringInfoString(), deparse_context::buf, buf, deparse_context::indentLevel, Max, PRETTY_INDENT, PRETTYINDENT_LIMIT, PRETTYINDENT_STD, removeStringInfoSpaces(), and generate_unaccent_rules::str.
Referenced by get_basic_select_query(), get_delete_query_def(), get_from_clause(), get_from_clause_item(), get_insert_query_def(), get_merge_query_def(), get_rule_expr(), get_rule_windowclause(), get_select_query_def(), get_setop_query(), get_target_list(), get_update_query_def(), get_utility_query_def(), and get_with_clause().
|
static |
Definition at line 4764 of file ruleutils.c.
References deparse_columns::colnames, i, lfirst, deparse_columns::new_colnames, deparse_columns::num_cols, deparse_columns::num_new_cols, deparse_columns::parentUsing, and deparse_namespace::using_names.
Referenced by make_colname_unique().
|
static |
Definition at line 2577 of file ruleutils.c.
References appendStringInfo(), appendStringInfoString(), buf, DatumGetArrayTypeP, DatumGetInt16(), deconstruct_array_builtin(), get_attname(), j, and quote_identifier().
Referenced by pg_get_constraintdef_worker().
Definition at line 3660 of file ruleutils.c.
References AccessShareLock, RangeTblEntry::alias, deparse_namespace::appendrels, deparse_namespace::ctes, RangeTblEntry::eref, RangeTblEntry::inFromCl, RangeTblEntry::inh, RangeTblEntry::lateral, list_make1, makeAlias(), makeNode, NIL, palloc0(), RangeTblEntry::relid, RangeTblEntry::relkind, RangeTblEntry::rellockmode, deparse_namespace::rtable, RTE_RELATION, RangeTblEntry::rtekind, set_rtable_names(), set_simple_column_names(), and deparse_namespace::subplans.
Referenced by pg_get_constraintdef_worker(), pg_get_expr_worker(), pg_get_indexdef_worker(), pg_get_partconstrdef_string(), pg_get_partition_constraintdef(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), transformPartitionBound(), and transformPartitionRangeBounds().
List* deparse_context_for_plan_tree | ( | PlannedStmt * | pstmt, |
List * | rtable_names | ||
) |
Definition at line 3705 of file ruleutils.c.
References PlannedStmt::appendRelations, deparse_namespace::appendrels, Assert(), AppendRelInfo::child_relid, deparse_namespace::ctes, lfirst_node, list_length(), list_make1, NIL, palloc0(), deparse_namespace::rtable, PlannedStmt::rtable, deparse_namespace::rtable_names, set_simple_column_names(), deparse_namespace::subplans, and PlannedStmt::subplans.
Referenced by ExplainPrintPlan().
Definition at line 3600 of file ruleutils.c.
References deparse_expression_pretty().
Referenced by AlterDomainDefault(), DefineDomain(), pg_get_function_arg_default(), pg_get_partconstrdef_string(), print_function_arguments(), show_expression(), show_grouping_set_keys(), show_memoize_info(), show_plan_tlist(), show_sort_group_keys(), show_tablesample(), transformPartitionBound(), and transformPartitionRangeBounds().
|
static |
Definition at line 3627 of file ruleutils.c.
References deparse_context::appendparents, deparse_context::buf, buf, EXPR_KIND_NONE, get_rule_expr(), deparse_context::indentLevel, initStringInfo(), deparse_context::namespaces, NIL, deparse_context::prettyFlags, deparse_context::special_exprkind, deparse_context::varprefix, deparse_context::windowClause, deparse_context::windowTList, WRAP_COLUMN_DEFAULT, and deparse_context::wrapColumn.
Referenced by deparse_expression(), pg_get_constraintdef_worker(), pg_get_expr_worker(), pg_get_indexdef_worker(), pg_get_partition_constraintdef(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), and pg_get_statisticsobjdef_expressions().
|
static |
Definition at line 4857 of file ruleutils.c.
References deparse_columns::colnames, deparse_columns::num_cols, palloc0_array, and repalloc0_array.
Referenced by set_join_column_names(), set_relation_column_names(), and set_using_names().
|
static |
Definition at line 8024 of file ruleutils.c.
References deparse_namespace::ancestors, arg, SubPlan::args, elog(), ERROR, for_each_cell, forboth, innerPlan, IsA, lfirst, lfirst_int, linitial, lnext(), deparse_context::namespaces, NestLoop::nestParams, PARAM_EXEC, Param::paramid, Param::paramkind, NestLoopParam::paramno, NestLoopParam::paramval, SubPlan::parParam, and deparse_namespace::plan.
Referenced by get_name_for_var_field(), and get_parameter().
|
static |
Definition at line 5041 of file ruleutils.c.
References deparse_namespace::ancestors, elog(), ERROR, IsA, lfirst, and WorkTableScan::wtParam.
Referenced by set_deparse_plan().
|
static |
Definition at line 12577 of file ruleutils.c.
References buf, elog(), ERROR, get_reloptions(), HeapTupleIsValid, initStringInfo(), ObjectIdGetDatum(), ReleaseSysCache(), RELOID, SearchSysCache1(), and SysCacheGetAttr().
Referenced by pg_get_constraintdef_worker(), and pg_get_indexdef_worker().
char* generate_collation_name | ( | Oid | collid | ) |
Definition at line 12477 of file ruleutils.c.
References CollationIsVisible(), collid, COLLOID, elog(), ERROR, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), quote_qualified_identifier(), ReleaseSysCache(), and SearchSysCache1().
Referenced by get_const_collation(), get_from_clause_coldeflist(), get_rule_expr(), pg_collation_for(), pg_get_indexdef_worker(), and pg_get_partkeydef_worker().
|
static |
Definition at line 12191 of file ruleutils.c.
References Assert(), elog(), ERROR, EXPR_KIND_GROUP_BY, func_get_detail(), FUNCDETAIL_AGGREGATE, FUNCDETAIL_NORMAL, FUNCDETAIL_NOTFOUND, FUNCDETAIL_WINDOWFUNC, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, InvalidOid, list_make1, makeString(), NameStr, NIL, ObjectIdGetDatum(), OidIsValid, PROCOID, proname, quote_qualified_identifier(), ReleaseSysCache(), and SearchSysCache1().
Referenced by get_agg_expr_helper(), get_func_expr(), get_tablesample_def(), get_windowfunc_expr_helper(), pg_get_functiondef(), and pg_get_triggerdef_worker().
char* generate_opclass_name | ( | Oid | opclass | ) |
Definition at line 11835 of file ruleutils.c.
References buf, get_opclass_name(), initStringInfo(), and InvalidOid.
Referenced by index_opclass_options().
void generate_operator_clause | ( | StringInfo | buf, |
const char * | leftop, | ||
Oid | leftoptype, | ||
Oid | opoid, | ||
const char * | rightop, | ||
Oid | rightoptype | ||
) |
Definition at line 12373 of file ruleutils.c.
References add_cast_to(), appendStringInfo(), appendStringInfoString(), Assert(), buf, elog(), ERROR, get_namespace_name(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), OPEROID, quote_identifier(), ReleaseSysCache(), and SearchSysCache1().
Referenced by refresh_by_match_merge(), and ri_GenerateQual().
Definition at line 12296 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), buf, elog(), ERROR, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, initStringInfo(), left_oper(), list_make1, makeString(), NameStr, ObjectIdGetDatum(), oper(), OPEROID, oprid(), quote_identifier(), ReleaseSysCache(), and SearchSysCache1().
Referenced by get_oper_expr(), get_rule_expr(), get_rule_orderby(), get_simple_binary_op_name(), get_sublink_expr(), and pg_get_indexdef_worker().
|
static |
Definition at line 12149 of file ruleutils.c.
References elog(), ERROR, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), quote_qualified_identifier(), ReleaseSysCache(), relname, RELOID, and SearchSysCache1().
Referenced by make_ruledef(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), pg_get_serial_sequence(), and pg_get_triggerdef_worker().
|
static |
Definition at line 12444 of file ruleutils.c.
References elog(), ERROR, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), quote_qualified_identifier(), ReleaseSysCache(), SearchSysCache1(), TYPEOID, and typname.
Referenced by pg_get_constraintdef_worker().
Definition at line 12089 of file ruleutils.c.
References CommonTableExpr::ctename, deparse_namespace::ctes, elog(), ERROR, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, lfirst, NameStr, ObjectIdGetDatum(), quote_qualified_identifier(), RelationIsVisible(), ReleaseSysCache(), relname, RELOID, and SearchSysCache1().
Referenced by get_delete_query_def(), get_from_clause_item(), get_insert_query_def(), get_merge_query_def(), get_rule_expr(), get_update_query_def(), make_ruledef(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), pg_get_statisticsobj_worker(), and pg_get_triggerdef_worker().
|
static |
Definition at line 10207 of file ruleutils.c.
References elog(), ERROR, get_agg_expr(), and IsA.
Referenced by get_agg_expr_helper().
|
static |
Definition at line 10069 of file ruleutils.c.
References get_agg_expr_helper().
Referenced by get_agg_combine_expr(), and get_rule_expr().
|
static |
Definition at line 10081 of file ruleutils.c.
References Aggref::aggdirectargs, Aggref::aggdistinct, Aggref::aggfilter, Aggref::aggfnoid, Aggref::aggorder, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), arg, Aggref::args, Assert(), deparse_context::buf, buf, DO_AGGSPLIT_COMBINE, DO_AGGSPLIT_SKIPFINAL, TargetEntry::expr, FUNC_MAX_ARGS, funcname, generate_function_name(), get_agg_combine_expr(), get_aggregate_argtypes(), get_rule_expr(), get_rule_orderby(), i, IsA, lfirst, linitial_node, list_length(), NIL, resolve_special_varno(), and deparse_context::special_exprkind.
Referenced by get_agg_expr(), and get_json_agg_constructor().
|
static |
Definition at line 5890 of file ruleutils.c.
References appendContextKeyword(), appendStringInfoChar(), appendStringInfoString(), deparse_context::buf, buf, Query::distinctClause, EXPR_KIND_GROUP_BY, get_from_clause(), get_rule_expr(), get_rule_groupingset(), get_rule_sortgroupclause(), get_rule_windowclause(), get_simple_values_rte(), get_target_list(), get_values_def(), Query::groupClause, Query::groupDistinct, Query::groupingSets, Query::havingQual, deparse_context::indentLevel, Query::jointree, lfirst, NIL, PRETTY_INDENT, PRETTYINDENT_STD, FromExpr::quals, deparse_context::special_exprkind, Query::targetList, SortGroupClause::tleSortGroupRef, RangeTblEntry::values_lists, and Query::windowClause.
Referenced by get_select_query_def().
|
static |
Definition at line 10569 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), arg, deparse_context::buf, buf, format_type_with_typemod(), get_const_expr(), get_rule_expr_paren(), IsA, and PRETTY_PAREN.
Referenced by get_func_expr(), and get_rule_expr().
|
static |
Definition at line 11662 of file ruleutils.c.
References appendStringInfoChar(), appendStringInfoString(), deparse_context::buf, buf, i, deparse_columns::new_colnames, deparse_columns::num_new_cols, deparse_columns::printaliases, and quote_identifier().
Referenced by get_from_clause_item().
|
static |
Definition at line 10763 of file ruleutils.c.
References appendStringInfo(), deparse_context::buf, buf, Const::consttype, generate_collation_name(), get_typcollation(), and OidIsValid.
Referenced by get_const_expr().
|
static |
Definition at line 10633 of file ruleutils.c.
References appendStringInfo(), appendStringInfoString(), deparse_context::buf, buf, Const::consttype, format_type_with_typemod(), get_const_collation(), getTypeOutputInfo(), OidOutputFunctionCall(), pfree(), and simple_quote_literal().
Referenced by get_coercion_expr(), get_range_partbound_string(), get_rule_expr(), and get_rule_sortgroupclause().
|
static |
Definition at line 7036 of file ruleutils.c.
References appendContextKeyword(), appendStringInfo(), appendStringInfoChar(), Assert(), deparse_context::buf, buf, generate_relation_name(), get_from_clause(), get_rte_alias(), get_rule_expr(), get_target_list(), get_with_clause(), deparse_context::indentLevel, Query::jointree, NIL, only_marker, PRETTY_INDENT, PRETTYINDENT_STD, FromExpr::quals, RangeTblEntry::relid, Query::returningList, rt_fetch, Query::rtable, RTE_RELATION, and RangeTblEntry::rtekind.
Referenced by get_query_def().
|
static |
Definition at line 11206 of file ruleutils.c.
References appendBinaryStringInfo(), appendContextKeyword(), appendStringInfoString(), deparse_context::buf, buf, StringInfoData::data, FromExpr::fromlist, get_from_clause_item(), RangeTblEntry::inFromCl, initStringInfo(), IsA, Query::jointree, StringInfoData::len, lfirst, pfree(), PRETTY_INDENT, PRETTYINDENT_STD, PRETTYINDENT_VAR, removeStringInfoSpaces(), rt_fetch, Query::rtable, and deparse_context::wrapColumn.
Referenced by get_basic_select_query(), get_delete_query_def(), get_merge_query_def(), and get_update_query_def().
|
static |
Definition at line 11702 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), Assert(), attname, deparse_context::buf, buf, deparse_columns::colnames, forfour, format_type_with_typemod(), generate_collation_name(), get_typcollation(), i, lfirst, lfirst_int, lfirst_oid, OidIsValid, quote_identifier(), and strVal.
Referenced by get_from_clause_item().
|
static |
Definition at line 11300 of file ruleutils.c.
References appendContextKeyword(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), generate_unaccent_rules::args, deparse_context::buf, buf, RangeTblEntry::ctename, deparse_columns_fetch, elog(), ERROR, RangeTblFunction::funcexpr, RangeTblEntry::funcordinality, RangeTblEntry::functions, generate_relation_name(), get_column_alias_list(), get_from_clause_coldeflist(), get_query_def(), get_rtable_name(), get_rte_alias(), get_rule_expr(), get_rule_expr_funccall(), get_tablefunc(), get_tablesample_def(), get_values_def(), deparse_context::indentLevel, IsA, j, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, RangeTblEntry::lateral, lfirst, linitial, list_concat(), list_length(), deparse_context::namespaces, NIL, nodeTag, only_marker, PRETTY_PAREN, deparse_context::prettyFlags, PRETTYINDENT_JOIN, PRETTYINDENT_STD, quote_identifier(), RangeTblEntry::relid, rt_fetch, Query::rtable, RTE_CTE, RTE_FUNCTION, RTE_RELATION, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, RangeTblEntry::rtekind, RangeTblEntry::subquery, RangeTblEntry::tablefunc, RangeTblEntry::tablesample, deparse_columns::usingNames, RangeTblEntry::values_lists, and deparse_context::wrapColumn.
Referenced by get_from_clause().
|
static |
Definition at line 9973 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), arg, FuncExpr::args, deparse_context::buf, buf, COERCE_EXPLICIT_CAST, COERCE_IMPLICIT_CAST, COERCE_SQL_SYNTAX, ereport, errcode(), errmsg(), ERROR, exprIsLengthCoercion(), exprType(), FUNC_MAX_ARGS, FuncExpr::funcid, generate_function_name(), get_coercion_expr(), get_func_sql_syntax(), get_rule_expr(), get_rule_expr_paren(), IsA, lappend(), lfirst, linitial, list_length(), lnext(), NIL, and deparse_context::special_exprkind.
Referenced by get_rule_expr().
|
static |
Definition at line 10327 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), FuncExpr::args, Assert(), deparse_context::buf, buf, Const::consttype, FuncExpr::funcid, get_rule_expr(), get_rule_expr_paren(), IsA, lfourth, linitial, list_length(), lsecond, lthird, and TextDatumGetCString.
Referenced by get_func_expr().
|
static |
Definition at line 6610 of file ruleutils.c.
References OnConflictExpr::action, appendContextKeyword(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), OnConflictExpr::arbiterElems, OnConflictExpr::arbiterWhere, Assert(), deparse_context::buf, buf, OnConflictExpr::constraint, elog(), ERROR, TargetEntry::expr, generate_relation_name(), get_attname(), get_constraint_name(), get_query_def(), get_rte_alias(), get_rule_expr(), get_rule_list_toplevel(), get_target_list(), get_update_query_targetlist_def(), get_values_def(), get_with_clause(), deparse_context::indentLevel, lappend(), lfirst, deparse_context::namespaces, NIL, OidIsValid, Query::onConflict, ONCONFLICT_NOTHING, OnConflictExpr::onConflictSet, OnConflictExpr::onConflictWhere, OVERRIDING_SYSTEM_VALUE, OVERRIDING_USER_VALUE, PRETTY_INDENT, deparse_context::prettyFlags, PRETTYINDENT_STD, processIndirection(), quote_identifier(), RangeTblEntry::relid, TargetEntry::resno, Query::returningList, rt_fetch, Query::rtable, RTE_RELATION, RTE_SUBQUERY, RTE_VALUES, RangeTblEntry::rtekind, RangeTblEntry::subquery, Query::targetList, RangeTblEntry::values_lists, deparse_context::varprefix, and deparse_context::wrapColumn.
Referenced by get_query_def().
|
static |
Definition at line 10924 of file ruleutils.c.
References elog(), ERROR, JsonConstructorExpr::func, funcname, get_agg_expr_helper(), get_json_constructor_options(), get_windowfunc_expr_helper(), initStringInfo(), IsA, nodeTag, and options.
Referenced by get_json_constructor().
|
static |
Definition at line 10828 of file ruleutils.c.
References appendStringInfo(), appendStringInfoString(), JsonConstructorExpr::args, deparse_context::buf, buf, elog(), ERROR, foreach_current_index, funcname, get_json_agg_constructor(), get_json_constructor_options(), get_rule_expr(), JSCTOR_JSON_ARRAY, JSCTOR_JSON_ARRAYAGG, JSCTOR_JSON_OBJECT, JSCTOR_JSON_OBJECTAGG, JSCTOR_JSON_PARSE, JSCTOR_JSON_SCALAR, JSCTOR_JSON_SERIALIZE, lfirst, and JsonConstructorExpr::type.
Referenced by get_rule_expr().
|
static |
Definition at line 10894 of file ruleutils.c.
References JsonConstructorExpr::absent_on_null, appendStringInfoString(), buf, get_json_returning(), JSCTOR_JSON_ARRAY, JSCTOR_JSON_ARRAYAGG, JSCTOR_JSON_OBJECT, JSCTOR_JSON_OBJECTAGG, JSCTOR_JSON_PARSE, JSCTOR_JSON_SCALAR, JsonConstructorExpr::returning, JsonConstructorExpr::type, and JsonConstructorExpr::unique.
Referenced by get_json_agg_constructor(), and get_json_constructor().
|
static |
Definition at line 10783 of file ruleutils.c.
References appendStringInfo(), appendStringInfoString(), buf, encoding, format, JS_ENC_DEFAULT, JS_ENC_UTF16, JS_ENC_UTF32, JS_FORMAT_DEFAULT, and JS_FORMAT_JSONB.
Referenced by get_json_returning(), and get_rule_expr().
|
static |
Definition at line 10808 of file ruleutils.c.
References appendStringInfo(), buf, JsonReturning::format, JsonFormat::format_type, format_type_with_typemod(), get_json_format(), JS_FORMAT_JSON, JS_FORMAT_JSONB, OidIsValid, JsonReturning::typid, and JsonReturning::typmod.
Referenced by get_json_constructor_options().
|
static |
Definition at line 7088 of file ruleutils.c.
References generate_unaccent_rules::action, appendContextKeyword(), appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), Assert(), deparse_context::buf, buf, CMD_DELETE, CMD_INSERT, CMD_NOTHING, CMD_UPDATE, TargetEntry::expr, generate_relation_name(), get_attname(), get_from_clause(), get_rte_alias(), get_rule_expr(), get_rule_list_toplevel(), get_update_query_targetlist_def(), get_with_clause(), deparse_context::indentLevel, Query::jointree, lappend(), lfirst, lfirst_node, Query::mergeActionList, NIL, only_marker, OVERRIDING_SYSTEM_VALUE, OVERRIDING_USER_VALUE, PRETTY_INDENT, PRETTYINDENT_STD, processIndirection(), FromExpr::quals, quote_identifier(), RangeTblEntry::relid, TargetEntry::resno, Query::returningList, rt_fetch, Query::rtable, RTE_RELATION, and RangeTblEntry::rtekind.
Referenced by get_query_def().
|
static |
Definition at line 7618 of file ruleutils.c.
References Alias::aliasname, Assert(), attname, attnum, RangeTblEntry::ctelevelsup, RangeTblEntry::ctename, CommonTableExpr::ctename, CommonTableExpr::ctequery, deparse_namespace::ctes, elog(), RangeTblEntry::eref, ERROR, TargetEntry::expr, find_param_referent(), get_expr_result_tupdesc(), get_rte_attribute_name(), get_tle_by_resno(), GetCTETargetList, if(), deparse_namespace::index_tlist, INDEX_VAR, deparse_namespace::inner_plan, deparse_namespace::inner_tlist, INNER_VAR, InvalidAttrNumber, IsA, RangeTblEntry::joinaliasvars, lcons(), lfirst, list_copy_tail(), list_length(), list_nth(), deparse_context::namespaces, NameStr, NIL, deparse_namespace::outer_plan, deparse_namespace::outer_tlist, OUTER_VAR, deparse_namespace::plan, pop_ancestor_plan(), pop_child_plan(), push_ancestor_plan(), push_child_plan(), rt_fetch, deparse_namespace::rtable, RTE_CTE, RTE_FUNCTION, RTE_JOIN, RTE_NAMEDTUPLESTORE, RTE_RELATION, RTE_RESULT, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, RangeTblEntry::rtekind, set_deparse_for_query(), strVal, RangeTblEntry::subquery, Query::targetList, TupleDescAttr, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by get_rule_expr().
|
static |
Definition at line 11797 of file ruleutils.c.
References appendStringInfo(), buf, CLAOID, elog(), ERROR, get_namespace_name_or_temp(), GetDefaultOpClass(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), OidIsValid, OpclassIsVisible(), quote_identifier(), ReleaseSysCache(), and SearchSysCache1().
Referenced by generate_opclass_name(), get_rule_expr(), pg_get_indexdef_worker(), and pg_get_partkeydef_worker().
|
static |
Definition at line 9933 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), arg, generate_unaccent_rules::args, OpExpr::args, deparse_context::buf, buf, exprType(), generate_operator_name(), get_rule_expr_paren(), InvalidOid, linitial, list_length(), lsecond, OpExpr::opno, and PRETTY_PAREN.
Referenced by get_rule_expr().
|
static |
Definition at line 8134 of file ruleutils.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), deparse_namespace::argnames, deparse_context::buf, find_param_referent(), deparse_namespace::funcname, get_rule_expr(), IsA, lfirst, llast, deparse_context::namespaces, NIL, deparse_namespace::numargs, PARAM_EXTERN, Param::paramid, Param::paramkind, pop_ancestor_plan(), push_ancestor_plan(), quote_identifier(), deparse_namespace::rtable_names, and deparse_context::varprefix.
Referenced by get_rule_expr().
|
static |
Definition at line 5429 of file ruleutils.c.
References AcquireRewriteLocks(), deparse_context::appendparents, appendStringInfoString(), deparse_context::buf, buf, CHECK_FOR_INTERRUPTS, check_stack_depth(), CMD_DELETE, CMD_INSERT, CMD_MERGE, CMD_NOTHING, CMD_SELECT, CMD_UPDATE, CMD_UTILITY, Query::commandType, elog(), ERROR, EXPR_KIND_NONE, get_delete_query_def(), get_insert_query_def(), get_merge_query_def(), get_select_query_def(), get_update_query_def(), get_utility_query_def(), deparse_context::indentLevel, lcons(), list_copy(), list_length(), deparse_context::namespaces, NIL, deparse_context::prettyFlags, Query::rtable, set_deparse_for_query(), deparse_context::special_exprkind, deparse_context::varprefix, deparse_context::windowClause, deparse_context::windowTList, and deparse_context::wrapColumn.
Referenced by get_from_clause_item(), get_insert_query_def(), get_setop_query(), get_sublink_expr(), get_with_clause(), make_ruledef(), make_viewdef(), pg_get_querydef(), and print_function_sqlbody().
char* get_range_partbound_string | ( | List * | bound_datums | ) |
Definition at line 12610 of file ruleutils.c.
References appendStringInfoChar(), appendStringInfoString(), deparse_context::buf, buf, castNode, get_const_expr(), PartitionRangeDatum::kind, lfirst_node, makeStringInfo(), PARTITION_RANGE_DATUM_MAXVALUE, PARTITION_RANGE_DATUM_MINVALUE, val, and PartitionRangeDatum::value.
Referenced by check_new_partition_bound(), and get_rule_expr().
|
static |
Definition at line 12069 of file ruleutils.c.
References elog(), ERROR, get_rel_name(), and relname.
Referenced by get_rte_alias(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), pg_get_partition_constraintdef(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), and pg_get_statisticsobjdef_expressions().
|
static |
Definition at line 12522 of file ruleutils.c.