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

This commit is contained in:
Bruce Momjian 1998-01-22 23:05:18 +00:00
parent 0fd8d60185
commit 7015dfef4b
4 changed files with 33 additions and 7 deletions

View File

@ -10,7 +10,7 @@
*
*
* 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
* AUTHOR DATE MAJOR EVENT
@ -116,7 +116,7 @@ Oid param_type(int t); /* used in parse_expr.c */
CopyStmt, CreateStmt, CreateAsStmt, CreateSeqStmt, DefineStmt, DestroyStmt,
ExtendStmt, FetchStmt, GrantStmt, CreateTrigStmt, DropTrigStmt,
CreatePLangStmt, DropPLangStmt,
IndexStmt, ListenStmt, OptimizableStmt,
IndexStmt, ListenStmt, LockStmt, OptimizableStmt,
ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt,
RemoveFuncStmt, RemoveStmt,
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
@ -276,7 +276,7 @@ Oid param_type(int t); /* used in parse_expr.c */
DATABASE, DELIMITERS, DO, EXPLAIN, EXTEND,
FORWARD, FUNCTION, HANDLER,
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,
RECIPE, RENAME, REPLACE, RESET, RETURNS, RULE,
SEQUENCE, SETOF, SHOW, STDIN, STDOUT, TRUSTED,
@ -364,6 +364,7 @@ stmt : AddAttrStmt
| GrantStmt
| IndexStmt
| ListenStmt
| LockStmt
| ProcedureStmt
| RecipeStmt
| RemoveAggrStmt
@ -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;
}
;
/*****************************************************************************
*

View File

@ -7,7 +7,7 @@
*
*
* 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[] = {
{"load", LOAD},
{"local", LOCAL},
{"location", LOCATION},
{"lock", LOCK_P},
{"match", MATCH},
{"merge", MERGE},
{"minute", MINUTE_P},

View File

@ -5,7 +5,7 @@
*
* 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[] = {
{"load",
"dynamically load a module",
"load <filename>;"},
{"lock",
"exclusive lock a table inside a transaction",
"lock <class_name>;"},
{"move",
"move an cursor position",
"move [forward|backward] [<number>|all] [in <cursorname>];"},

View File

@ -1,9 +1,9 @@
.\" This is -*-nroff-*-
.\" 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
.SH NAME
declere - declare a cursor
declare - declare a cursor
.SH SYNOPSIS
.nf
\fBdeclare\fR [ \fBbinary\fR ] \fBcursor for\fR select statement