PostgreSQL Source Code: src/include/nodes/nodes.h File Reference (original) (raw)

#include "nodes/nodetags.h"

Go to the source code of this file.

Data Structures
struct Node
Macros
#define pg_node_attr(...)
#define nodeTag(nodeptr) (((const Node*)(nodeptr))->type)
#define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_))
#define NodeSetTag(nodeptr, t) (((Node*)(nodeptr))->type = (t))
#define IsA(nodeptr, _type_) (nodeTag(nodeptr) == T_##_type_)
#define castNode(_type_, nodeptr) ((_type_ *) (nodeptr))
#define copyObject(obj) copyObjectImpl(obj)
#define IS_OUTER_JOIN(jointype)
#define AGGSPLITOP_COMBINE 0x01 /* substitute combinefn for transfn */
#define AGGSPLITOP_SKIPFINAL 0x02 /* skip finalfn, return state as-is */
#define AGGSPLITOP_SERIALIZE 0x04 /* apply serialfn to output */
#define AGGSPLITOP_DESERIALIZE 0x08 /* apply deserialfn to input */
#define DO_AGGSPLIT_COMBINE(as) (((as) & AGGSPLITOP_COMBINE) != 0)
#define DO_AGGSPLIT_SKIPFINAL(as) (((as) & AGGSPLITOP_SKIPFINAL) != 0)
#define DO_AGGSPLIT_SERIALIZE(as) (((as) & AGGSPLITOP_SERIALIZE) != 0)
#define DO_AGGSPLIT_DESERIALIZE(as) (((as) & AGGSPLITOP_DESERIALIZE) != 0)
Typedefs
typedef enum NodeTag NodeTag
typedef struct Node Node
typedef int ParseLoc
typedef double Selectivity
typedef double Cost
typedef double Cardinality
typedef enum CmdType CmdType
typedef enum JoinType JoinType
typedef enum AggStrategy AggStrategy
typedef enum AggSplit AggSplit
typedef enum SetOpCmd SetOpCmd
typedef enum SetOpStrategy SetOpStrategy
typedef enum OnConflictAction OnConflictAction
typedef enum LimitOption LimitOption
Enumerations
enum NodeTag { T_Invalid = 0 }
enum CmdType { CMD_UNKNOWN, CMD_SELECT, CMD_UPDATE, CMD_INSERT, CMD_DELETE, CMD_MERGE, CMD_UTILITY, CMD_NOTHING }
enum JoinType { JOIN_INNER, JOIN_LEFT, JOIN_FULL, JOIN_RIGHT, JOIN_SEMI, JOIN_ANTI, JOIN_RIGHT_SEMI, JOIN_RIGHT_ANTI, JOIN_UNIQUE_OUTER, JOIN_UNIQUE_INNER }
enum AggStrategy { AGG_PLAIN, AGG_SORTED, AGG_HASHED, AGG_MIXED }
enum AggSplit { AGGSPLIT_SIMPLE = 0 , AGGSPLIT_INITIAL_SERIAL = AGGSPLITOP_SKIPFINAL | AGGSPLITOP_SERIALIZE , AGGSPLIT_FINAL_DESERIAL = AGGSPLITOP_COMBINE AGGSPLITOP_DESERIALIZE }
enum SetOpCmd { SETOPCMD_INTERSECT, SETOPCMD_INTERSECT_ALL, SETOPCMD_EXCEPT, SETOPCMD_EXCEPT_ALL }
enum SetOpStrategy { SETOP_SORTED, SETOP_HASHED }
enum OnConflictAction { ONCONFLICT_NONE, ONCONFLICT_NOTHING, ONCONFLICT_UPDATE }
enum LimitOption { LIMIT_OPTION_COUNT, LIMIT_OPTION_WITH_TIES }
Functions
static Node * newNode (size_t size, NodeTag tag)
void outNode (struct StringInfoData *str, const void *obj)
void outToken (struct StringInfoData *str, const char *s)
void outBitmapset (struct StringInfoData *str, const struct Bitmapset *bms)
void outDatum (struct StringInfoData *str, Datum value, int typlen, bool typbyval)
char * nodeToString (const void *obj)
char * nodeToStringWithLocations (const void *obj)
char * bmsToString (const struct Bitmapset *bms)
void * stringToNode (const char *str)
struct Bitmapset * readBitmapset (void)
Datum readDatum (bool typbyval)
bool * readBoolCols (int numCols)
int * readIntCols (int numCols)
Oid * readOidCols (int numCols)
int16 * readAttrNumberCols (int numCols)
void * copyObjectImpl (const void *from)
bool equal (const void *a, const void *b)

AGGSPLITOP_COMBINE

#define AGGSPLITOP_COMBINE 0x01 /* substitute combinefn for transfn */

AGGSPLITOP_DESERIALIZE

#define AGGSPLITOP_DESERIALIZE 0x08 /* apply deserialfn to input */

AGGSPLITOP_SERIALIZE

#define AGGSPLITOP_SERIALIZE 0x04 /* apply serialfn to output */

AGGSPLITOP_SKIPFINAL

#define AGGSPLITOP_SKIPFINAL 0x02 /* skip finalfn, return state as-is */

castNode

| #define castNode | ( | | _type_, | | ---------------- | ------------------------- | | --------- | | | nodeptr | | | | | ) | ((_type_ *) (nodeptr)) | | |

copyObject

DO_AGGSPLIT_COMBINE

DO_AGGSPLIT_DESERIALIZE

DO_AGGSPLIT_SERIALIZE

DO_AGGSPLIT_SKIPFINAL

IS_OUTER_JOIN

| #define IS_OUTER_JOIN | ( | | jointype | ) | | ----------------------- | - | | -------- | - |

IsA

| #define IsA | ( | | nodeptr, | | ----------- | ---------------------------------------------------------------------------------------- | | -------- | | | _type_ | | | | | ) | (nodeTag(nodeptr) == T_##_type_) | | |

makeNode

| #define makeNode | ( | | _type_ | ) | ((_type_ *) newNode(sizeof(_type_),T_##_type_)) | | ---------------- | - | | -------- | - | ------------------------------------------------------------------------------------------------------------ |

NodeSetTag

| #define NodeSetTag | ( | | nodeptr, | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | | -------- | | | t | | | | | ) | (((Node*)(nodeptr))->type = (t)) | | |

nodeTag

| #define nodeTag | ( | | nodeptr | ) | (((const Node*)(nodeptr))->type) | | --------------- | - | | ------- | - | ------------------------------------------------------------------------------------------------------------------------------ |

pg_node_attr

| #define pg_node_attr | ( | | ... | ) | | ---------------------- | - | | ----- | - |

AggSplit

AggStrategy

Cardinality

CmdType

Cost

JoinType

LimitOption

Node

NodeTag

OnConflictAction

ParseLoc

Selectivity

SetOpCmd

SetOpStrategy

AggSplit

Enumerator
AGGSPLIT_SIMPLE
AGGSPLIT_INITIAL_SERIAL
AGGSPLIT_FINAL_DESERIAL

Definition at line 384 of file nodes.h.

385{

386

388

390

#define AGGSPLITOP_DESERIALIZE

#define AGGSPLITOP_SKIPFINAL

#define AGGSPLITOP_SERIALIZE

@ AGGSPLIT_FINAL_DESERIAL

@ AGGSPLIT_INITIAL_SERIAL

#define AGGSPLITOP_COMBINE

AggStrategy

Enumerator
AGG_PLAIN
AGG_SORTED
AGG_HASHED
AGG_MIXED

Definition at line 362 of file nodes.h.

CmdType

Enumerator
CMD_UNKNOWN
CMD_SELECT
CMD_UPDATE
CMD_INSERT
CMD_DELETE
CMD_MERGE
CMD_UTILITY
CMD_NOTHING

Definition at line 272 of file nodes.h.

JoinType

Enumerator
JOIN_INNER
JOIN_LEFT
JOIN_FULL
JOIN_RIGHT
JOIN_SEMI
JOIN_ANTI
JOIN_RIGHT_SEMI
JOIN_RIGHT_ANTI
JOIN_UNIQUE_OUTER
JOIN_UNIQUE_INNER

Definition at line 297 of file nodes.h.

LimitOption

Enumerator
LIMIT_OPTION_COUNT
LIMIT_OPTION_WITH_TIES

Definition at line 439 of file nodes.h.

NodeTag

Enumerator
T_Invalid

Definition at line 26 of file nodes.h.

27{

29

30#include "nodes/nodetags.h"

OnConflictAction

Enumerator
ONCONFLICT_NONE
ONCONFLICT_NOTHING
ONCONFLICT_UPDATE

Definition at line 426 of file nodes.h.

SetOpCmd

Enumerator
SETOPCMD_INTERSECT
SETOPCMD_INTERSECT_ALL
SETOPCMD_EXCEPT
SETOPCMD_EXCEPT_ALL

Definition at line 406 of file nodes.h.

SetOpStrategy

Enumerator
SETOP_SORTED
SETOP_HASHED

Definition at line 414 of file nodes.h.

bmsToString()

char * bmsToString ( const struct Bitmapset * bms )

copyObjectImpl()

void * copyObjectImpl ( const void * from )

Definition at line 177 of file copyfuncs.c.

178{

179 void *retval;

180

181 if (from == NULL)

182 return NULL;

183

184

186

188 {

189#include "copyfuncs.switch.c"

190

191 case T_List:

193 break;

194

195

196

197

198

199 case T_IntList:

200 case T_OidList:

201 case T_XidList:

203 break;

204

205 default:

206 elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from));

207 retval = NULL;

208 break;

209 }

210

211 return retval;

212}

List * list_copy_deep(const List *oldlist)

List * list_copy(const List *oldlist)

void check_stack_depth(void)

References check_stack_depth(), elog, ERROR, list_copy(), list_copy_deep(), and nodeTag.

Referenced by list_copy_deep().

equal()

bool equal ( const void * a,
const void * b
)

Definition at line 223 of file equalfuncs.c.

224{

225 bool retval;

226

227 if (a == b)

228 return true;

229

230

231

232

233 if (a == NULL || b == NULL)

234 return false;

235

236

237

238

240 return false;

241

242

244

246 {

247#include "equalfuncs.switch.c"

248

249 case T_List:

250 case T_IntList:

251 case T_OidList:

252 case T_XidList:

254 break;

255

256 default:

257 elog(ERROR, "unrecognized node type: %d",

259 retval = false;

260 break;

261 }

262

263 return retval;

264}

static bool _equalList(const List *a, const List *b)

References _equalList(), a, b, check_stack_depth(), elog, ERROR, and nodeTag.

Referenced by _equalA_Const(), _equalList(), add_row_identity_var(), add_sp_item_to_pathtarget(), add_unique_group_var(), addRangeClause(), AlterPublicationTables(), calc_hist_selectivity_scalar(), calc_length_hist_frac(), check_new_partition_bound(), check_partition_bounds_for_split_list(), clause_is_strict_for(), CompareIndexInfo(), convert_subquery_pathkeys(), create_ordered_paths(), create_projection_path(), CreateStatistics(), deparseParam(), deparseVar(), dependencies_clauselist_selectivity(), dependency_is_compatible_expression(), ec_member_matches_foreign(), equalPolicy(), equalRuleLocks(), estimate_multivariate_bucketsize(), estimate_multivariate_ndistinct(), examine_variable(), ExecInitWindowAgg(), expand_grouping_sets(), exprs_known_equal(), finalize_grouping_exprs_walker(), find_compatible_agg(), find_ec_member_matching_expr(), find_em_for_rel_target(), find_list_position(), find_minmax_agg_replacement_param(), findTargetlistEntrySQL92(), findTargetlistEntrySQL99(), fix_expr_common(), fix_indexqual_operand(), get_eclass_for_sort_expr(), get_expression_sortgroupref(), get_partition_for_tuple(), get_variable(), group_by_has_partkey(), grouping_planner(), infer_collation_opclass_match(), length_hist_bsearch(), list_delete(), list_member(), list_member_rangevar(), match_boolean_partition_clause(), match_clause_to_partition_key(), match_eclasses_to_foreign_key_col(), match_expr_to_partition_keys(), match_index_to_operand(), match_unique_clauses(), matches_boolean_partition_clause(), maybe_reread_subscription(), mcv_match_expression(), MergeAttributes(), MergeCheckConstraint(), MergeWithExistingConstraint(), operator_predicate_proof(), optimize_window_clauses(), pg_parse_query(), pg_plan_query(), pg_rewrite_query(), plan_union_children(), predicate_implied_by_simple_clause(), predicate_refuted_by_simple_clause(), preprocess_groupclause(), process_duplicate_ors(), process_equivalence(), process_matched_tle(), process_subquery_nestloop_params(), rbound_bsearch(), recomputeNamespacePath(), reconsider_full_join_clause(), reconsider_outer_join_clause(), RelationGetIndexAttrBitmap(), replace_nestloop_param_placeholdervar(), replace_nestloop_param_var(), replace_relid_callback(), restrict_infos_logically_equal(), search_indexed_tlist_for_sortgroupref(), split_selfjoin_quals(), stat_find_expression(), substitute_grouped_columns_mutator(), tlist_member(), tlist_same_exprs(), transformIndexConstraints(), transformPartitionBound(), transformPartitionCmdForMerge(), transformPartitionCmdForSplit(), transformWindowFuncCall(), trivial_subqueryscan(), and update_eclasses().

newNode()

static Node * newNode ( size_t size, NodeTag tag ) inlinestatic

nodeToString()

char * nodeToString ( const void * obj )

Definition at line 802 of file outfuncs.c.

803{

805}

static char * nodeToStringInternal(const void *obj, bool write_loc_fields)

References nodeToStringInternal().

Referenced by AlterDomainDefault(), AlterPolicy(), CreatePolicy(), CreateStatistics(), createTableConstraints(), CreateTriggerFiringOn(), DefineDomain(), domainAddCheckConstraint(), ExecSerializePlan(), expandTableLikeClause(), InsertRule(), ProcedureCreate(), publication_add_relation(), StoreAttrDefault(), StorePartitionBound(), StorePartitionKey(), StoreRelCheck(), and UpdateIndexRelation().

nodeToStringWithLocations()

char * nodeToStringWithLocations ( const void * obj )

outBitmapset()

outDatum()

outNode()

outToken()

readAttrNumberCols()

int16 * readAttrNumberCols ( int numCols )

readBitmapset()

readBoolCols()

bool * readBoolCols ( int numCols )

readDatum()

Datum readDatum ( bool typbyval )

Definition at line 600 of file readfuncs.c.

601{

603 int tokenLength;

604 const char *token;

606 char *s;

607

608

609

610

613

615 if (token == NULL || token[0] != '[')

616 elog(ERROR, "expected \"[\" to start datum, but got \"%s\"; length = %zu",

618

619 if (typbyval)

620 {

621 if (length > (Size) sizeof(Datum))

622 elog(ERROR, "byval datum but length = %zu", length);

624 s = (char *) (&res);

626 {

628 s[i] = (char) atoi(token);

629 }

630 }

631 else if (length <= 0)

633 else

634 {

635 s = (char *) palloc(length);

636 for (Size i = 0; i < length; i++)

637 {

639 s[i] = (char) atoi(token);

640 }

642 }

643

645 if (token == NULL || token[0] != ']')

646 elog(ERROR, "expected \"]\" to end datum, but got \"%s\"; length = %zu",

648

649 return res;

650}

static Datum PointerGetDatum(const void *X)

const char * pg_strtok(int *length)

References atoui, elog, ERROR, i, palloc(), pg_strtok(), PointerGetDatum(), and token.

Referenced by _readConst().

readIntCols()

int * readIntCols ( int numCols )

readOidCols()

Oid * readOidCols ( int numCols )

stringToNode()

void * stringToNode ( const char * str )

Definition at line 90 of file read.c.

91{

93}

static void * stringToNodeInternal(const char *str, bool restore_loc_fields)

References str, and stringToNodeInternal().

Referenced by AddRelationNewConstraints(), AlterPolicy(), AlterPublicationTables(), CloneRowTriggersToPartition(), ConstraintImpliedByRelConstraint(), createTableConstraints(), ExecParallelGetQueryDesc(), ExecRelCheck(), expandTableLikeClause(), fetch_function_defaults(), fetch_statentries_for_relation(), fmgr_sql_validator(), func_get_detail(), generate_partition_qual(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), GenerateTypeDependencies(), get_dependent_generated_columns(), get_partition_bound_spec(), get_qual_for_range(), get_relation_constraints(), get_relation_statistics(), get_typdefault(), index_concurrently_create_copy(), inline_function(), inline_sql_function_in_from(), load_domaintype_info(), make_ruledef(), make_viewdef(), MergeAttributes(), MergeWithExistingConstraint(), pg_get_constraintdef_worker(), pg_get_expr_worker(), pg_get_function_arg_default(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), pg_get_triggerdef_worker(), pgoutput_row_filter_init(), print_function_arguments(), print_function_sqlbody(), ProcedureCreate(), pub_rf_contains_invalid_column(), QueueCheckConstraintValidation(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationGetDummyIndexExpressions(), RelationGetIndexAttrBitmap(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), sql_compile_callback(), TriggerEnabled(), TupleDescGetDefault(), TypeCreate(), and validateDomainCheckConstraint().