Commit 7015dfef authored by Bruce Momjian's avatar Bruce Momjian

Add LOCK command as DELETE FROM ... WHERE false.

parent 0fd8d601
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.95 1998/01/20 05:04:07 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.96 1998/01/22 23:04:52 momjian Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -116,7 +116,7 @@ Oid param_type(int t); /* used in parse_expr.c */ ...@@ -116,7 +116,7 @@ Oid param_type(int t); /* used in parse_expr.c */
CopyStmt, CreateStmt, CreateAsStmt, CreateSeqStmt, DefineStmt, DestroyStmt, CopyStmt, CreateStmt, CreateAsStmt, CreateSeqStmt, DefineStmt, DestroyStmt,
ExtendStmt, FetchStmt, GrantStmt, CreateTrigStmt, DropTrigStmt, ExtendStmt, FetchStmt, GrantStmt, CreateTrigStmt, DropTrigStmt,
CreatePLangStmt, DropPLangStmt, CreatePLangStmt, DropPLangStmt,
IndexStmt, ListenStmt, OptimizableStmt, IndexStmt, ListenStmt, LockStmt, OptimizableStmt,
ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt, ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt,
RemoveFuncStmt, RemoveStmt, RemoveFuncStmt, RemoveStmt,
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt, RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
...@@ -276,7 +276,7 @@ Oid param_type(int t); /* used in parse_expr.c */ ...@@ -276,7 +276,7 @@ Oid param_type(int t); /* used in parse_expr.c */
DATABASE, DELIMITERS, DO, EXPLAIN, EXTEND, DATABASE, DELIMITERS, DO, EXPLAIN, EXTEND,
FORWARD, FUNCTION, HANDLER, FORWARD, FUNCTION, HANDLER,
INDEX, INHERITS, INSTEAD, ISNULL, INDEX, INHERITS, INSTEAD, ISNULL,
LANCOMPILER, LISTEN, LOAD, LOCATION, MERGE, MOVE, LANCOMPILER, LISTEN, LOAD, LOCK_P, LOCATION, MERGE, MOVE,
NEW, NONE, NOTHING, NOTNULL, OIDS, OPERATOR, PROCEDURAL, NEW, NONE, NOTHING, NOTNULL, OIDS, OPERATOR, PROCEDURAL,
RECIPE, RENAME, REPLACE, RESET, RETURNS, RULE, RECIPE, RENAME, REPLACE, RESET, RETURNS, RULE,
SEQUENCE, SETOF, SHOW, STDIN, STDOUT, TRUSTED, SEQUENCE, SETOF, SHOW, STDIN, STDOUT, TRUSTED,
...@@ -364,6 +364,7 @@ stmt : AddAttrStmt ...@@ -364,6 +364,7 @@ stmt : AddAttrStmt
| GrantStmt | GrantStmt
| IndexStmt | IndexStmt
| ListenStmt | ListenStmt
| LockStmt
| ProcedureStmt | ProcedureStmt
| RecipeStmt | RecipeStmt
| RemoveAggrStmt | RemoveAggrStmt
...@@ -2210,6 +2211,27 @@ DeleteStmt: DELETE FROM relation_name ...@@ -2210,6 +2211,27 @@ DeleteStmt: DELETE FROM relation_name
} }
; ;
/*
* Total hack to just lock a table inside a transaction.
* Is it worth making this a separate command, with
* its own node type and file. I don't think so. bjm 1998/1/22
*/
LockStmt: LOCK_P relation_name
{
DeleteStmt *n = makeNode(DeleteStmt);
A_Const *c = makeNode(A_Const);
c->val.type = T_String;
c->val.val.str = "f";
c->typename = makeNode(TypeName);
c->typename->name = xlateSqlType("bool");
n->relname = $2;
n->whereClause = c;
$$ = (Node *)n;
}
;
/***************************************************************************** /*****************************************************************************
* *
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.31 1998/01/20 05:04:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.32 1998/01/22 23:04:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -127,6 +127,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -127,6 +127,7 @@ static ScanKeyword ScanKeywords[] = {
{"load", LOAD}, {"load", LOAD},
{"local", LOCAL}, {"local", LOCAL},
{"location", LOCATION}, {"location", LOCATION},
{"lock", LOCK_P},
{"match", MATCH}, {"match", MATCH},
{"merge", MERGE}, {"merge", MERGE},
{"minute", MINUTE_P}, {"minute", MINUTE_P},
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: psqlHelp.h,v 1.38 1998/01/11 20:02:15 momjian Exp $ * $Id: psqlHelp.h,v 1.39 1998/01/22 23:05:09 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -250,6 +250,9 @@ static struct _helpStruct QL_HELP[] = { ...@@ -250,6 +250,9 @@ static struct _helpStruct QL_HELP[] = {
{"load", {"load",
"dynamically load a module", "dynamically load a module",
"load <filename>;"}, "load <filename>;"},
{"lock",
"exclusive lock a table inside a transaction",
"lock <class_name>;"},
{"move", {"move",
"move an cursor position", "move an cursor position",
"move [forward|backward] [<number>|all] [in <cursorname>];"}, "move [forward|backward] [<number>|all] [in <cursorname>];"},
......
.\" This is -*-nroff-*- .\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here.... .\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/declare.l,v 1.2 1998/01/11 22:17:24 momjian Exp $ .\" $Header: /cvsroot/pgsql/src/man/Attic/declare.l,v 1.3 1998/01/22 23:05:18 momjian Exp $
.TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL .TH FETCH SQL 01/23/93 PostgreSQL PostgreSQL
.SH NAME .SH NAME
declere - declare a cursor declare - declare a cursor
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
\fBdeclare\fR [ \fBbinary\fR ] \fBcursor for\fR select statement \fBdeclare\fR [ \fBbinary\fR ] \fBcursor for\fR select statement
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment