diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
-rw-r--r-- | src/include/nodes/makefuncs.h | 13 | ||||
-rw-r--r-- | src/include/nodes/nodes.h | 5 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 6 | ||||
-rw-r--r-- | src/include/nodes/primnodes.h | 125 | ||||
-rw-r--r-- | src/include/optimizer/tlist.h | 7 |
6 files changed, 69 insertions, 91 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 45b1695fcaa..4243ce19b28 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.262 2005/03/29 19:44:23 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.263 2005/04/06 16:34:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200503291 +#define CATALOG_VERSION_NO 200504061 #endif diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h index 8d50f499718..52444d258b6 100644 --- a/src/include/nodes/makefuncs.h +++ b/src/include/nodes/makefuncs.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.51 2004/12/31 22:03:34 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/nodes/makefuncs.h,v 1.52 2005/04/06 16:34:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,13 +29,12 @@ extern Var *makeVar(Index varno, int32 vartypmod, Index varlevelsup); -extern TargetEntry *makeTargetEntry(Resdom *resdom, Expr *expr); +extern TargetEntry *makeTargetEntry(Expr *expr, + AttrNumber resno, + char *resname, + bool resjunk); -extern Resdom *makeResdom(AttrNumber resno, - Oid restype, - int32 restypmod, - char *resname, - bool resjunk); +extern TargetEntry *flatCopyTargetEntry(TargetEntry *src_tle); extern Const *makeConst(Oid consttype, int constlen, diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 5d70180a0c5..4822b5f6cc4 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.164 2005/03/14 00:19:37 neilc Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.165 2005/04/06 16:34:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -93,8 +93,7 @@ typedef enum NodeTag /* * TAGS FOR PRIMITIVE NODES (primnodes.h) */ - T_Resdom = 300, - T_Alias, + T_Alias = 300, T_RangeVar, T_Expr, T_Var, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index a6a79e3a4fa..85016f35112 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.275 2005/03/29 17:58:51 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.276 2005/04/06 16:34:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -552,11 +552,11 @@ typedef struct RangeTblEntry * SortClause - * representation of ORDER BY clauses * - * tleSortGroupRef must match ressortgroupref of exactly one Resdom of the + * tleSortGroupRef must match ressortgroupref of exactly one entry of the * associated targetlist; that is the expression to be sorted (or grouped) by. * sortop is the OID of the ordering operator. * - * SortClauses are also used to identify Resdoms that we will do a "Unique" + * SortClauses are also used to identify targets that we will do a "Unique" * filter step on (for SELECT DISTINCT and SELECT DISTINCT ON). The * distinctClause list is simply a copy of the relevant members of the * sortClause list. Note that distinctClause can be a subset of sortClause, diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 46de880565a..a1d1ef3ebf0 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.106 2004/12/31 22:03:34 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.107 2005/04/06 16:34:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,72 +27,6 @@ * ---------------------------------------------------------------- */ -/*-------------------- - * Resdom (Result Domain) - * - * Notes: - * - * In a SELECT's targetlist, resno should always be equal to the item's - * ordinal position (counting from 1). However, in an INSERT or UPDATE - * targetlist, resno represents the attribute number of the destination - * column for the item; so there may be missing or out-of-order resnos. - * It is even legal to have duplicated resnos; consider - * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ... - * The two meanings come together in the executor, because the planner - * transforms INSERT/UPDATE tlists into a normalized form with exactly - * one entry for each column of the destination table. Before that's - * happened, however, it is risky to assume that resno == position. - * Generally get_tle_by_resno() should be used rather than list_nth() - * to fetch tlist entries by resno, and only in SELECT should you assume - * that resno is a unique identifier. - * - * resname is required to represent the correct column name in non-resjunk - * entries of top-level SELECT targetlists, since it will be used as the - * column title sent to the frontend. In most other contexts it is only - * a debugging aid, and may be wrong or even NULL. (In particular, it may - * be wrong in a tlist from a stored rule, if the referenced column has been - * renamed by ALTER TABLE since the rule was made. Also, the planner tends - * to store NULL rather than look up a valid name for tlist entries in - * non-toplevel plan nodes.) In resjunk entries, resname should be either - * a specific system-generated name (such as "ctid") or NULL; anything else - * risks confusing ExecGetJunkAttribute! - * - * ressortgroupref is used in the representation of ORDER BY and - * GROUP BY items. Targetlist entries with ressortgroupref=0 are not - * sort/group items. If ressortgroupref>0, then this item is an ORDER BY or - * GROUP BY value. No two entries in a targetlist may have the same nonzero - * ressortgroupref --- but there is no particular meaning to the nonzero - * values, except as tags. (For example, one must not assume that lower - * ressortgroupref means a more significant sort key.) The order of the - * associated SortClause or GroupClause lists determine the semantics. - * - * resorigtbl/resorigcol identify the source of the column, if it is a - * simple reference to a column of a base table (or view). If it is not - * a simple reference, these fields are zeroes. - * - * If resjunk is true then the column is a working column (such as a sort key) - * that should be removed from the final output of the query. Resjunk columns - * must have resnos that cannot duplicate any regular column's resno. Also - * note that there are places that assume resjunk columns come after non-junk - * columns. - *-------------------- - */ -typedef struct Resdom -{ - NodeTag type; - AttrNumber resno; /* attribute number (see notes above) */ - Oid restype; /* type of the value */ - int32 restypmod; /* type-specific modifier of the value */ - char *resname; /* name of the column (could be NULL) */ - Index ressortgroupref;/* nonzero if referenced by a sort/group - * clause */ - Oid resorigtbl; /* OID of column's source table */ - AttrNumber resorigcol; /* column's number in source table */ - bool resjunk; /* set to true to eliminate the attribute - * from final target list */ -} Resdom; - - /* * Alias - * specifies an alias for a range variable; the alias might also @@ -822,7 +756,7 @@ typedef struct SetToDefault int32 typeMod; /* typemod for substituted value */ } SetToDefault; -/* +/*-------------------- * TargetEntry - * a target entry (used in query target lists) * @@ -831,14 +765,63 @@ typedef struct SetToDefault * very many places it's convenient to process a whole query targetlist as a * single expression tree. * - * The separation between TargetEntry and Resdom is historical. One of these - * days, Resdom should probably get folded into TargetEntry. + * In a SELECT's targetlist, resno should always be equal to the item's + * ordinal position (counting from 1). However, in an INSERT or UPDATE + * targetlist, resno represents the attribute number of the destination + * column for the item; so there may be missing or out-of-order resnos. + * It is even legal to have duplicated resnos; consider + * UPDATE table SET arraycol[1] = ..., arraycol[2] = ..., ... + * The two meanings come together in the executor, because the planner + * transforms INSERT/UPDATE tlists into a normalized form with exactly + * one entry for each column of the destination table. Before that's + * happened, however, it is risky to assume that resno == position. + * Generally get_tle_by_resno() should be used rather than list_nth() + * to fetch tlist entries by resno, and only in SELECT should you assume + * that resno is a unique identifier. + * + * resname is required to represent the correct column name in non-resjunk + * entries of top-level SELECT targetlists, since it will be used as the + * column title sent to the frontend. In most other contexts it is only + * a debugging aid, and may be wrong or even NULL. (In particular, it may + * be wrong in a tlist from a stored rule, if the referenced column has been + * renamed by ALTER TABLE since the rule was made. Also, the planner tends + * to store NULL rather than look up a valid name for tlist entries in + * non-toplevel plan nodes.) In resjunk entries, resname should be either + * a specific system-generated name (such as "ctid") or NULL; anything else + * risks confusing ExecGetJunkAttribute! + * + * ressortgroupref is used in the representation of ORDER BY and + * GROUP BY items. Targetlist entries with ressortgroupref=0 are not + * sort/group items. If ressortgroupref>0, then this item is an ORDER BY or + * GROUP BY value. No two entries in a targetlist may have the same nonzero + * ressortgroupref --- but there is no particular meaning to the nonzero + * values, except as tags. (For example, one must not assume that lower + * ressortgroupref means a more significant sort key.) The order of the + * associated SortClause or GroupClause lists determine the semantics. + * + * resorigtbl/resorigcol identify the source of the column, if it is a + * simple reference to a column of a base table (or view). If it is not + * a simple reference, these fields are zeroes. + * + * If resjunk is true then the column is a working column (such as a sort key) + * that should be removed from the final output of the query. Resjunk columns + * must have resnos that cannot duplicate any regular column's resno. Also + * note that there are places that assume resjunk columns come after non-junk + * columns. + *-------------------- */ typedef struct TargetEntry { Expr xpr; - Resdom *resdom; /* descriptor for targetlist item */ Expr *expr; /* expression to evaluate */ + AttrNumber resno; /* attribute number (see notes above) */ + char *resname; /* name of the column (could be NULL) */ + Index ressortgroupref;/* nonzero if referenced by a sort/group + * clause */ + Oid resorigtbl; /* OID of column's source table */ + AttrNumber resorigcol; /* column's number in source table */ + bool resjunk; /* set to true to eliminate the attribute + * from final target list */ } TargetEntry; diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h index 33df54cd5d6..91418033ae1 100644 --- a/src/include/optimizer/tlist.h +++ b/src/include/optimizer/tlist.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/tlist.h,v 1.41 2004/12/31 22:03:36 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/tlist.h,v 1.42 2005/04/06 16:34:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,10 +17,7 @@ #include "nodes/relation.h" -extern TargetEntry *tlistentry_member(Node *node, List *targetlist); -extern Resdom *tlist_member(Node *node, List *targetlist); - -extern TargetEntry *create_tl_element(Var *var, int resdomno); +extern TargetEntry *tlist_member(Node *node, List *targetlist); extern List *flatten_tlist(List *tlist); extern List *add_to_flat_tlist(List *tlist, List *vars); |