aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/parsenodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-02-22 19:23:23 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-02-22 19:24:40 -0500
commitbdca82f44d0e0168dece56cbd53b54ba142f328f (patch)
tree0a627b98d399ddce7b4523cf1d138e721a860f9d /src/include/nodes/parsenodes.h
parent1c51c7d5ffd407426f314b2cd317ef77f14efb1f (diff)
downloadpostgresql-bdca82f44d0e0168dece56cbd53b54ba142f328f.tar.gz
postgresql-bdca82f44d0e0168dece56cbd53b54ba142f328f.zip
Add a relkind field to RangeTblEntry to avoid some syscache lookups.
The recent additions for FDW support required checking foreign-table-ness in several places in the parse/plan chain. While it's not clear whether that would really result in a noticeable slowdown, it seems best to avoid any performance risk by keeping a copy of the relation's relkind in RangeTblEntry. That might have some other uses later, anyway. Per discussion.
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r--src/include/nodes/parsenodes.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 63a61e3da24..536c03245e3 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -597,6 +597,9 @@ typedef struct XmlSerialize
* like outer joins and join-output-column aliasing.) Other special
* RTE types also exist, as indicated by RTEKind.
*
+ * Note that we consider RTE_RELATION to cover anything that has a pg_class
+ * entry. relkind distinguishes the sub-cases.
+ *
* alias is an Alias node representing the AS alias-clause attached to the
* FROM expression, or NULL if no clause.
*
@@ -643,7 +646,7 @@ typedef struct XmlSerialize
* indicates no permissions checking). If checkAsUser is not zero,
* then do the permissions checks using the access rights of that user,
* not the current effective user ID. (This allows rules to act as
- * setuid gateways.)
+ * setuid gateways.) Permissions checks only apply to RELATION RTEs.
*
* For SELECT/INSERT/UPDATE permissions, if the user doesn't have
* table-wide permissions then it is sufficient to have the permissions
@@ -660,7 +663,6 @@ typedef enum RTEKind
RTE_RELATION, /* ordinary relation reference */
RTE_SUBQUERY, /* subquery in FROM */
RTE_JOIN, /* join */
- RTE_SPECIAL, /* special rule relation (NEW or OLD) */
RTE_FUNCTION, /* function in FROM */
RTE_VALUES, /* VALUES (<exprlist>), (<exprlist>), ... */
RTE_CTE /* common table expr (WITH list element) */
@@ -682,6 +684,7 @@ typedef struct RangeTblEntry
* Fields valid for a plain relation RTE (else zero):
*/
Oid relid; /* OID of the relation */
+ char relkind; /* relation kind (see pg_class.relkind) */
/*
* Fields valid for a subquery RTE (else NULL):