summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/nodes/execnodes.h6
-rw-r--r--src/include/nodes/nodes.h3
-rw-r--r--src/include/nodes/parsenodes.h30
-rw-r--r--src/include/parser/analyze.h6
-rw-r--r--src/include/parser/parse_node.h6
-rw-r--r--src/include/parser/parsetree.h9
7 files changed, 41 insertions, 23 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index f3c037f97c..4c76aa70fa 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.327 2006/04/30 02:09:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.328 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200604291
+#define CATALOG_VERSION_NO 200604301
#endif
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 2d346df359..7a9a651e1e 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.149 2006/03/05 15:58:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.150 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -321,8 +321,6 @@ typedef struct EState
uint32 es_processed; /* # of tuples processed */
Oid es_lastoid; /* last oid processed (by INSERT) */
List *es_rowMarks; /* not good place, but there is no other */
- bool es_forUpdate; /* true = FOR UPDATE, false = FOR SHARE */
- bool es_rowNoWait; /* FOR UPDATE/SHARE NOWAIT option */
bool es_instrument; /* true requests runtime instrumentation */
bool es_select_into; /* true if doing SELECT INTO */
@@ -351,6 +349,8 @@ typedef struct ExecRowMark
{
Relation relation; /* opened and RowShareLock'd relation */
Index rti; /* its range table index */
+ bool forUpdate; /* true = FOR UPDATE, false = FOR SHARE */
+ bool noWait; /* NOWAIT option */
char resname[32]; /* name for its ctid junk attribute */
} ExecRowMark;
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index fe5ab018f5..53f3ee1d61 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.185 2006/04/15 17:45:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.186 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -320,6 +320,7 @@ typedef enum NodeTag
T_InhRelation,
T_FunctionParameter,
T_LockingClause,
+ T_RowMarkClause,
/*
* TAGS FOR RANDOM OTHER STUFF
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index a0a31be51b..896b426370 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.309 2006/04/30 02:09:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.310 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ typedef uint32 AclMode; /* a bitmask of privilege bits */
#define ACL_USAGE (1<<8) /* for languages and namespaces */
#define ACL_CREATE (1<<9) /* for namespaces and databases */
#define ACL_CREATE_TEMP (1<<10) /* for databases */
-#define ACL_CONNECT (1<<11) /* for database connection privilege */
+#define ACL_CONNECT (1<<11) /* for databases */
#define N_ACL_RIGHTS 12 /* 1 plus the last 1<<x */
#define ACL_NO_RIGHTS 0
/* Currently, SELECT ... FOR UPDATE/FOR SHARE requires UPDATE privileges */
@@ -102,13 +102,6 @@ typedef struct Query
List *rtable; /* list of range table entries */
FromExpr *jointree; /* table join tree (FROM and WHERE clauses) */
- List *rowMarks; /* integer list of RT indexes of relations
- * that are selected FOR UPDATE/SHARE */
-
- bool forUpdate; /* true if rowMarks are FOR UPDATE, false if
- * they are FOR SHARE */
- bool rowNoWait; /* FOR UPDATE/SHARE NOWAIT option */
-
List *targetList; /* target list (of TargetEntry) */
List *groupClause; /* a list of GroupClause's */
@@ -122,6 +115,8 @@ typedef struct Query
Node *limitOffset; /* # of result tuples to skip */
Node *limitCount; /* # of result tuples to return */
+ List *rowMarks; /* a list of RowMarkClause's */
+
Node *setOperations; /* set-operation tree if this is top level of
* a UNION/INTERSECT/EXCEPT query */
@@ -448,7 +443,7 @@ typedef struct LockingClause
NodeTag type;
List *lockedRels; /* FOR UPDATE or FOR SHARE relations */
bool forUpdate; /* true = FOR UPDATE, false = FOR SHARE */
- bool nowait; /* NOWAIT option */
+ bool noWait; /* NOWAIT option */
} LockingClause;
@@ -615,6 +610,19 @@ typedef struct SortClause
*/
typedef SortClause GroupClause;
+/*
+ * RowMarkClause -
+ * representation of FOR UPDATE/SHARE clauses
+ *
+ * We create a separate RowMarkClause node for each target relation
+ */
+typedef struct RowMarkClause
+{
+ NodeTag type;
+ Index rti; /* range table index of target relation */
+ bool forUpdate; /* true = FOR UPDATE, false = FOR SHARE */
+ bool noWait; /* NOWAIT option */
+} RowMarkClause;
/*****************************************************************************
* Optimizable Statements
@@ -724,7 +732,7 @@ typedef struct SelectStmt
List *sortClause; /* sort clause (a list of SortBy's) */
Node *limitOffset; /* # of result tuples to skip */
Node *limitCount; /* # of result tuples to return */
- LockingClause *lockingClause; /* FOR UPDATE/FOR SHARE */
+ List *lockingClause; /* FOR UPDATE (list of LockingClause's) */
/*
* These fields are used only in upper-level SelectStmts.
diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h
index 57188b9fce..0b245c77e8 100644
--- a/src/include/parser/analyze.h
+++ b/src/include/parser/analyze.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/parser/analyze.h,v 1.32 2006/03/14 22:48:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/parser/analyze.h,v 1.33 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,6 +22,8 @@ extern List *parse_analyze_varparams(Node *parseTree, const char *sourceText,
Oid **paramTypes, int *numParams);
extern List *parse_sub_analyze(Node *parseTree, ParseState *parentParseState);
extern List *analyzeCreateSchemaStmt(CreateSchemaStmt *stmt);
-extern void CheckSelectLocking(Query *qry, bool forUpdate);
+extern void CheckSelectLocking(Query *qry);
+extern void applyLockingClause(Query *qry, Index rtindex,
+ bool forUpdate, bool noWait);
#endif /* ANALYZE_H */
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index 2c23cf7894..1a28d09954 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.48 2006/03/14 22:48:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/parser/parse_node.h,v 1.49 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,8 +71,8 @@ typedef struct ParseState
Oid *p_paramtypes; /* OIDs of types for $n parameter symbols */
int p_numparams; /* allocated size of p_paramtypes[] */
int p_next_resno; /* next targetlist resno to assign */
- LockingClause *p_locking_clause; /* FOR UPDATE/FOR SHARE info */
- Node *p_value_substitute; /* what to replace VALUE with, if any */
+ List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */
+ Node *p_value_substitute; /* what to replace VALUE with, if any */
bool p_variableparams;
bool p_hasAggs;
bool p_hasSubLinks;
diff --git a/src/include/parser/parsetree.h b/src/include/parser/parsetree.h
index 5cd5002109..d9b65aec8c 100644
--- a/src/include/parser/parsetree.h
+++ b/src/include/parser/parsetree.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/parser/parsetree.h,v 1.32 2006/03/05 15:58:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/parser/parsetree.h,v 1.33 2006/04/30 18:30:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,4 +70,11 @@ extern bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno);
+/* ----------------
+ * FOR UPDATE/SHARE info
+ * ----------------
+ */
+
+extern RowMarkClause *get_rowmark(Query *qry, Index rtindex);
+
#endif /* PARSETREE_H */