Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
dfa23f5e
Commit
dfa23f5e
authored
Jan 05, 1999
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SELECT FOR UPDATE syntax
parent
b5626a20
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3631 additions
and
3613 deletions
+3631
-3613
src/backend/parser/gram.c
src/backend/parser/gram.c
+3596
-3608
src/backend/parser/gram.y
src/backend/parser/gram.y
+33
-4
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+2
-1
No files found.
src/backend/parser/gram.c
View file @
dfa23f5e
This diff is collapsed.
Click to expand it.
src/backend/parser/gram.y
View file @
dfa23f5e
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.4
1 1998/12/30 19:56:28 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.4
2 1999/01/05 15:46:25 vadim
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -174,7 +174,7 @@ Oid param_type(int t); /* used in parse_expr.c */
%type <boolean> TriggerForOpt, TriggerForType
%type <list> union_clause, select_list
%type <list> union_clause, select_list
, for_update_clause
%type <list> join_list
%type <joinusing>
join_using
...
...
@@ -2215,6 +2215,8 @@ ViewStmt: CREATE VIEW name AS SelectStmt
elog(ERROR,"Order by and Distinct on views is not implemented.");
if (((SelectStmt *)n->query)->unionClause != NULL)
elog(ERROR,"Views on unions not implemented.");
if (((SelectStmt *)n->query)->forUpdate != NULL)
elog(ERROR, "SELECT FOR UPDATE is not allowed in CREATE VIEW");
$$ = (Node *)n;
}
;
...
...
@@ -2677,7 +2679,7 @@ opt_of: OF columnList
SelectStmt: SELECT opt_unique res_target_list2
result from_clause where_clause
group_clause having_clause
union_clause sort_clause
union_clause sort_clause
for_update_clause
{
SelectStmt *n = makeNode(SelectStmt);
n->unique = $2;
...
...
@@ -2689,6 +2691,19 @@ SelectStmt: SELECT opt_unique res_target_list2
n->havingClause = $8;
n->unionClause = $9;
n->sortClause = $10;
n->forUpdate = $11;
if (n->forUpdate != NULL)
{
if (n->unionClause != NULL)
elog(ERROR, "SELECT FOR UPDATE is not allowed with UNION clause");
if (n->unique != NULL)
elog(ERROR, "SELECT FOR UPDATE is not allowed with DISTINCT clause");
if (n->groupClause != NULL)
elog(ERROR, "SELECT FOR UPDATE is not allowed with GROUP BY clause");
if (n->havingClause != NULL)
elog(ERROR, "SELECT FOR UPDATE is not allowed with HAVING clause");
}
else
$$ = (Node *)n;
}
;
...
...
@@ -2818,6 +2833,20 @@ having_clause: HAVING a_expr
| /*EMPTY*/ { $$ = NULL; }
;
for_update_clause:
FOR UPDATE
{
$$ = lcons(NULL, NULL);
}
| FOR UPDATE OF va_list
{
$$ = $4;
}
| /* EMPTY */
{
$$ = NULL;
}
;
/*****************************************************************************
*
...
...
src/include/nodes/parsenodes.h
View file @
dfa23f5e
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.6
4 1998/12/21 12:50:29 wieck
Exp $
* $Id: parsenodes.h,v 1.6
5 1999/01/05 15:45:49 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -653,6 +653,7 @@ typedef struct SelectStmt
bool
unionall
;
/* union without unique sort */
Node
*
limitOffset
;
/* # of result tuples to skip */
Node
*
limitCount
;
/* # of result tuples to return */
List
*
forUpdate
;
/* FOR UPDATE clause */
}
SelectStmt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment