Commit 01a651aa authored by Bruce Momjian's avatar Bruce Momjian

Fix compile error. Make transaction/work optional on all transaction

statements.  More cleanups of psql help.  Fix for shift/reduce on
UNION in subselect.
parent d8d0aa01
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.17 1998/07/25 00:17:28 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.18 1998/07/26 01:18:04 momjian Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -125,7 +125,7 @@ Oid param_type(int t); /* used in parse_expr.c */ ...@@ -125,7 +125,7 @@ Oid param_type(int t); /* used in parse_expr.c */
ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt, ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt,
RemoveFuncStmt, RemoveStmt, RemoveFuncStmt, RemoveStmt,
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt, RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
CreatedbStmt, DestroydbStmt, VacuumStmt, CursorStmt, SubSelect, CreatedbStmt, DestroydbStmt, VacuumStmt, CursorStmt, SubSelect, SubUnion,
UpdateStmt, InsertStmt, SelectStmt, NotifyStmt, DeleteStmt, ClusterStmt, UpdateStmt, InsertStmt, SelectStmt, NotifyStmt, DeleteStmt, ClusterStmt,
ExplainStmt, VariableSetStmt, VariableShowStmt, VariableResetStmt, ExplainStmt, VariableSetStmt, VariableShowStmt, VariableResetStmt,
CreateUserStmt, AlterUserStmt, DropUserStmt CreateUserStmt, AlterUserStmt, DropUserStmt
...@@ -339,7 +339,6 @@ Oid param_type(int t); /* used in parse_expr.c */ ...@@ -339,7 +339,6 @@ Oid param_type(int t); /* used in parse_expr.c */
%left '.' %left '.'
%left '[' ']' %left '[' ']'
%nonassoc TYPECAST %nonassoc TYPECAST
%nonassoc REDUCE
%left UNION %left UNION
%% %%
...@@ -2027,9 +2026,9 @@ TransactionStmt: ABORT_TRANS opt_trans ...@@ -2027,9 +2026,9 @@ TransactionStmt: ABORT_TRANS opt_trans
} }
; ;
opt_trans: WORK { $$ = NULL; } opt_trans: WORK { $$ = TRUE; }
| TRANSACTION { $$ = NULL: } | TRANSACTION { $$ = TRUE; }
| /*EMPTY*/ { $$ = NULL; } | /*EMPTY*/ { $$ = TRUE; }
; ;
...@@ -2438,6 +2437,23 @@ SelectStmt: SELECT opt_unique res_target_list2 ...@@ -2438,6 +2437,23 @@ SelectStmt: SELECT opt_unique res_target_list2
} }
; ;
SubSelect: SELECT opt_unique res_target_list2
from_clause where_clause
group_clause having_clause
union_clause
{
SelectStmt *n = makeNode(SelectStmt);
n->unique = $2;
n->targetList = $3;
n->fromClause = $4;
n->whereClause = $5;
n->groupClause = $6;
n->havingClause = $7;
n->unionClause = $8;
$$ = (Node *)n;
}
;
union_clause: UNION opt_union select_list union_clause: UNION opt_union select_list
{ {
SelectStmt *n = (SelectStmt *)lfirst($3); SelectStmt *n = (SelectStmt *)lfirst($3);
...@@ -2448,20 +2464,19 @@ union_clause: UNION opt_union select_list ...@@ -2448,20 +2464,19 @@ union_clause: UNION opt_union select_list
{ $$ = NIL; } { $$ = NIL; }
; ;
select_list: select_list UNION opt_union SubSelect select_list: select_list UNION opt_union SubUnion
{ {
SelectStmt *n = (SelectStmt *)$4; SelectStmt *n = (SelectStmt *)$4;
n->unionall = $3; n->unionall = $3;
$$ = lappend($1, $4); $$ = lappend($1, $4);
} }
| SubSelect | SubUnion
{ $$ = lcons($1, NIL); } { $$ = lcons($1, NIL); }
; ;
SubSelect: SELECT opt_unique res_target_list2 SubUnion: SELECT opt_unique res_target_list2
from_clause where_clause from_clause where_clause
group_clause having_clause group_clause having_clause
union_clause
{ {
SelectStmt *n = makeNode(SelectStmt); SelectStmt *n = makeNode(SelectStmt);
n->unique = $2; n->unique = $2;
...@@ -2471,7 +2486,6 @@ SubSelect: SELECT opt_unique res_target_list2 ...@@ -2471,7 +2486,6 @@ SubSelect: SELECT opt_unique res_target_list2
n->whereClause = $5; n->whereClause = $5;
n->groupClause = $6; n->groupClause = $6;
n->havingClause = $7; n->havingClause = $7;
n->unionClause = $8;
$$ = (Node *)n; $$ = (Node *)n;
} }
; ;
......
...@@ -97,136 +97,137 @@ typedef union ...@@ -97,136 +97,137 @@ typedef union
#define MATCH 324 #define MATCH 324
#define MINUTE_P 325 #define MINUTE_P 325
#define MONTH_P 326 #define MONTH_P 326
#define NATIONAL 327 #define NAMES 327
#define NATURAL 328 #define NATIONAL 328
#define NCHAR 329 #define NATURAL 329
#define NO 330 #define NCHAR 330
#define NOT 331 #define NO 331
#define NOTIFY 332 #define NOT 332
#define NULL_P 333 #define NOTIFY 333
#define NUMERIC 334 #define NULL_P 334
#define ON 335 #define NUMERIC 335
#define OPTION 336 #define ON 336
#define OR 337 #define OPTION 337
#define ORDER 338 #define OR 338
#define OUTER_P 339 #define ORDER 339
#define PARTIAL 340 #define OUTER_P 340
#define POSITION 341 #define PARTIAL 341
#define PRECISION 342 #define POSITION 342
#define PRIMARY 343 #define PRECISION 343
#define PRIVILEGES 344 #define PRIMARY 344
#define PROCEDURE 345 #define PRIVILEGES 345
#define PUBLIC 346 #define PROCEDURE 346
#define REFERENCES 347 #define PUBLIC 347
#define REVOKE 348 #define REFERENCES 348
#define RIGHT 349 #define REVOKE 349
#define ROLLBACK 350 #define RIGHT 350
#define SECOND_P 351 #define ROLLBACK 351
#define SELECT 352 #define SECOND_P 352
#define SET 353 #define SELECT 353
#define SUBSTRING 354 #define SET 354
#define TABLE 355 #define SUBSTRING 355
#define TIME 356 #define TABLE 356
#define TIMESTAMP 357 #define TIME 357
#define TIMEZONE_HOUR 358 #define TIMESTAMP 358
#define TIMEZONE_MINUTE 359 #define TIMEZONE_HOUR 359
#define TO 360 #define TIMEZONE_MINUTE 360
#define TRAILING 361 #define TO 361
#define TRANSACTION 362 #define TRAILING 362
#define TRIM 363 #define TRANSACTION 363
#define UNION 364 #define TRIM 364
#define UNIQUE 365 #define UNION 365
#define UPDATE 366 #define UNIQUE 366
#define USER 367 #define UPDATE 367
#define USING 368 #define USER 368
#define VALUES 369 #define USING 369
#define VARCHAR 370 #define VALUES 370
#define VARYING 371 #define VARCHAR 371
#define VIEW 372 #define VARYING 372
#define WHERE 373 #define VIEW 373
#define WITH 374 #define WHERE 374
#define WORK 375 #define WITH 375
#define YEAR_P 376 #define WORK 376
#define ZONE 377 #define YEAR_P 377
#define FALSE_P 378 #define ZONE 378
#define TRIGGER 379 #define FALSE_P 379
#define TRUE_P 380 #define TRIGGER 380
#define TYPE_P 381 #define TRUE_P 381
#define ABORT_TRANS 382 #define TYPE_P 382
#define AFTER 383 #define ABORT_TRANS 383
#define AGGREGATE 384 #define AFTER 384
#define ANALYZE 385 #define AGGREGATE 385
#define BACKWARD 386 #define ANALYZE 386
#define BEFORE 387 #define BACKWARD 387
#define BINARY 388 #define BEFORE 388
#define CACHE 389 #define BINARY 389
#define CLUSTER 390 #define CACHE 390
#define COPY 391 #define CLUSTER 391
#define CYCLE 392 #define COPY 392
#define DATABASE 393 #define CYCLE 393
#define DELIMITERS 394 #define DATABASE 394
#define DO 395 #define DELIMITERS 395
#define EACH 396 #define DO 396
#define EXPLAIN 397 #define EACH 397
#define EXTEND 398 #define EXPLAIN 398
#define FORWARD 399 #define EXTEND 399
#define FUNCTION 400 #define FORWARD 400
#define HANDLER 401 #define FUNCTION 401
#define INCREMENT 402 #define HANDLER 402
#define INDEX 403 #define INCREMENT 403
#define INHERITS 404 #define INDEX 404
#define INSTEAD 405 #define INHERITS 405
#define ISNULL 406 #define INSTEAD 406
#define LANCOMPILER 407 #define ISNULL 407
#define LISTEN 408 #define LANCOMPILER 408
#define LOAD 409 #define LISTEN 409
#define LOCK_P 410 #define LOAD 410
#define LOCATION 411 #define LOCK_P 411
#define MAXVALUE 412 #define LOCATION 412
#define MINVALUE 413 #define MAXVALUE 413
#define MOVE 414 #define MINVALUE 414
#define NEW 415 #define MOVE 415
#define NONE 416 #define NEW 416
#define NOTHING 417 #define NONE 417
#define NOTNULL 418 #define NOTHING 418
#define OIDS 419 #define NOTNULL 419
#define OPERATOR 420 #define OIDS 420
#define PROCEDURAL 421 #define OPERATOR 421
#define RECIPE 422 #define PROCEDURAL 422
#define RENAME 423 #define RECIPE 423
#define RESET 424 #define RENAME 424
#define RETURNS 425 #define RESET 425
#define ROW 426 #define RETURNS 426
#define RULE 427 #define ROW 427
#define SEQUENCE 428 #define RULE 428
#define SETOF 429 #define SEQUENCE 429
#define SHOW 430 #define SETOF 430
#define START 431 #define SHOW 431
#define STATEMENT 432 #define START 432
#define STDIN 433 #define STATEMENT 433
#define STDOUT 434 #define STDIN 434
#define TRUSTED 435 #define STDOUT 435
#define VACUUM 436 #define TRUSTED 436
#define VERBOSE 437 #define VACUUM 437
#define VERSION 438 #define VERBOSE 438
#define ARCHIVE 439 #define VERSION 439
#define PASSWORD 440 #define ENCODING 440
#define CREATEDB 441 #define ARCHIVE 441
#define NOCREATEDB 442 #define PASSWORD 442
#define CREATEUSER 443 #define CREATEDB 443
#define NOCREATEUSER 444 #define NOCREATEDB 444
#define VALID 445 #define CREATEUSER 445
#define UNTIL 446 #define NOCREATEUSER 446
#define IDENT 447 #define VALID 447
#define SCONST 448 #define UNTIL 448
#define Op 449 #define IDENT 449
#define ICONST 450 #define SCONST 450
#define PARAM 451 #define Op 451
#define FCONST 452 #define ICONST 452
#define OP 453 #define PARAM 453
#define UMINUS 454 #define FCONST 454
#define TYPECAST 455 #define OP 455
#define REDUCE 456 #define UMINUS 456
#define TYPECAST 457
extern YYSTYPE yylval; extern YYSTYPE yylval;
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.148 1998/07/18 18:34:14 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.149 1998/07/26 01:18:07 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1575,7 +1575,7 @@ do_help(PsqlSettings *pset, const char *topic) ...@@ -1575,7 +1575,7 @@ do_help(PsqlSettings *pset, const char *topic)
help_found = false; /* Haven't found it yet */ help_found = false; /* Haven't found it yet */
for (i = 0; QL_HELP[i].cmd; i++) for (i = 0; QL_HELP[i].cmd; i++)
{ {
if (strcmp(QL_HELP[i].cmd, topic) == 0 || if (strcasecmp(QL_HELP[i].cmd, topic) == 0 ||
strcmp(topic, "*") == 0) strcmp(topic, "*") == 0)
{ {
help_found = true; help_found = true;
......
...@@ -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.48 1998/07/25 00:17:29 momjian Exp $ * $Id: psqlHelp.h,v 1.49 1998/07/26 01:18:09 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -18,20 +18,20 @@ struct _helpStruct ...@@ -18,20 +18,20 @@ struct _helpStruct
}; };
static struct _helpStruct QL_HELP[] = { static struct _helpStruct QL_HELP[] = {
{"abort",
"abort the current transaction",
"abort [transaction];"},
{"abort transaction", {"abort transaction",
"abort the current transaction", "abort the current transaction",
"abort [transaction];"}, "\
\tabort [transaction|work];"},
{"alter table", {"alter table",
"add/rename attributes, rename tables", "add/rename attributes, rename tables",
"\tALTER TABLE class_name [*] ADD COLUMN attr type\n\ "\
\tALTER TABLE class_name [*] ADD COLUMN attr type\n\
\tALTER TABLE class_name [*] RENAME [COLUMN] attr1 TO attr2\n\ \tALTER TABLE class_name [*] RENAME [COLUMN] attr1 TO attr2\n\
\tALTER TABLE class_name1 RENAME TO class_name2"}, \tALTER TABLE class_name1 RENAME TO class_name2"},
{"alter user", {"alter user",
"alter system information for a user", "alter system information for a user",
"ALTER USER user_name\n\ "\
\tALTER USER user_name\n\
\t[WITH PASSWORD password]\n\ \t[WITH PASSWORD password]\n\
\t[CREATEDB | NOCCREATEDB]\n\ \t[CREATEDB | NOCCREATEDB]\n\
\t[CREATEUSER | NOCREATEUSER]\n\ \t[CREATEUSER | NOCREATEUSER]\n\
...@@ -39,23 +39,29 @@ static struct _helpStruct QL_HELP[] = { ...@@ -39,23 +39,29 @@ static struct _helpStruct QL_HELP[] = {
\t[VALID UNTIL 'abstime'];"}, \t[VALID UNTIL 'abstime'];"},
{"begin work", {"begin work",
"begin a new transaction", "begin a new transaction",
"BEGIN [TRANSACTION|WORK];"}, "\
\tBEGIN [WORK|TRANSACTION];"},
{"cluster", {"cluster",
"create a clustered index (from an existing index)", "create a clustered index (from an existing index)",
"CLUSTER index_name ON relation_name"}, "\
\tCLUSTER index_name ON relation_name"},
{"close", {"close",
"close an existing cursor (cursor)", "close an existing cursor (cursor)",
"CLOSE cursorname;"}, "\
\tCLOSE cursorname;"},
{"commit work", {"commit work",
"commit a transaction", "commit a transaction",
"COMMIT [TRANSACTION|WORK]"}, "\
\tCOMMIT [WORK|TRANSACTION]"},
{"copy", {"copy",
"copy data to and from a table", "copy data to and from a table",
"COPY [BINARY] class_name [WITH OIDS]\n\ "\
\tCOPY [BINARY] class_name [WITH OIDS]\n\
\tTO|FROM filename|STDIN|STDOUT [USING DELIMITERS 'delim'];"}, \tTO|FROM filename|STDIN|STDOUT [USING DELIMITERS 'delim'];"},
{"create", {"create",
"Please be more specific:", "Please be more specific:",
"\tcreate aggregate\n\ "\
\tcreate aggregate\n\
\tcreate database\n\ \tcreate database\n\
\tcreate function\n\ \tcreate function\n\
\tcreate index\n\ \tcreate index\n\
...@@ -68,26 +74,31 @@ static struct _helpStruct QL_HELP[] = { ...@@ -68,26 +74,31 @@ static struct _helpStruct QL_HELP[] = {
\tcreate view"}, \tcreate view"},
{"create aggregate", {"create aggregate",
"define an aggregate function", "define an aggregate function",
"CREATE AGGREGATE agg_name [AS] (BASETYPE = data_type, \n\ "\
\tCREATE AGGREGATE agg_name [AS] (BASETYPE = data_type, \n\
\t[SFUNC1 = sfunc_1, STYPE1 = sfunc1_return_type]\n\ \t[SFUNC1 = sfunc_1, STYPE1 = sfunc1_return_type]\n\
\t[SFUNC2 = sfunc_2, STYPE2 = sfunc2_return_type]\n\ \t[SFUNC2 = sfunc_2, STYPE2 = sfunc2_return_type]\n\
\t[,FINALFUNC = final-function]\n\ \t[,FINALFUNC = final-function]\n\
\t[,INITCOND1 = initial-cond1][,INITCOND2 = initial-cond2]);"}, \t[,INITCOND1 = initial-cond1][,INITCOND2 = initial-cond2]);"},
{"create database", {"create database",
"create a database", "create a database",
"CREATE DATABASE dbname [WITH LOCATION = 'dbpath']"}, "\
\tCREATE DATABASE dbname [WITH LOCATION = 'dbpath']"},
{"create function", {"create function",
"create a user-defined function", "create a user-defined function",
"CREATE FUNCTION function_name ([type1, ...typeN]) RETURNS return_type\n\ "\
\tCREATE FUNCTION function_name ([type1, ...typeN]) RETURNS return_type\n\
\tAS 'object_filename'|'sql-queries'\n\ \tAS 'object_filename'|'sql-queries'\n\
\tLANGUAGE 'c'|'sql'|'internal';"}, \tLANGUAGE 'c'|'sql'|'internal';"},
{"create index", {"create index",
"construct an index", "construct an index",
"CREATE [UNIQUE] INDEX indexname ON class_name [USING access_method]\n\ "\
\tCREATE [UNIQUE] INDEX indexname ON class_name [USING access_method]\n\
( attr1 [type_class1], ...attrN | funcname(attr1, ...) [type_class] );"}, ( attr1 [type_class1], ...attrN | funcname(attr1, ...) [type_class] );"},
{"create operator", {"create operator",
"create a user-defined operator", "create a user-defined operator",
"CREATE OPERATOR operator_name (\n\ "\
\tCREATE OPERATOR operator_name (\n\
\t[LEFTARG = type1][,RIGHTARG = type2]\n\ \t[LEFTARG = type1][,RIGHTARG = type2]\n\
\t,PROCEDURE = func_name,\n\ \t,PROCEDURE = func_name,\n\
\t[,COMMUTATOR = com_op][,NEGATOR = neg_op]\n\ \t[,COMMUTATOR = com_op][,NEGATOR = neg_op]\n\
...@@ -95,13 +106,15 @@ static struct _helpStruct QL_HELP[] = { ...@@ -95,13 +106,15 @@ static struct _helpStruct QL_HELP[] = {
\t[,JOIN = join_proc][,SORT = sort_op1...sort_opN]);"}, \t[,JOIN = join_proc][,SORT = sort_op1...sort_opN]);"},
{"create rule", {"create rule",
"define a new rule", "define a new rule",
"CREATE RULE rule_name AS ON\n\ "\
\tCREATE RULE rule_name AS ON\n\
\t[SELECT|UPDATE|DELETE|INSERT]\n\ \t[SELECT|UPDATE|DELETE|INSERT]\n\
\tTO object [WHERE qual]\n\ \tTO object [WHERE qual]\n\
\tDO [INSTEAD] [action|NOTHING|[actions]];"}, \tDO [INSTEAD] [action|NOTHING|[actions]];"},
{"create sequence", {"create sequence",
"create a new sequence number generator", "create a new sequence number generator",
"CREATE SEQUENCE sequence_name\n\ "\
\tCREATE SEQUENCE sequence_name\n\
\t[INCREMENT number]\n\ \t[INCREMENT number]\n\
\t[START number]\n\ \t[START number]\n\
\t[MINVALUE number]\n\ \t[MINVALUE number]\n\
...@@ -110,21 +123,24 @@ static struct _helpStruct QL_HELP[] = { ...@@ -110,21 +123,24 @@ static struct _helpStruct QL_HELP[] = {
\t[CYCLE];"}, \t[CYCLE];"},
{"create table", {"create table",
"create a new table", "create a new table",
"CREATE TABLE class_name\n\ "\
\tCREATE TABLE class_name\n\
\t(attr1 type1 [DEFAULT expression] [NOT NULL], ...attrN)\n\ \t(attr1 type1 [DEFAULT expression] [NOT NULL], ...attrN)\n\
\t[INHERITS (class_name1, ...class_nameN)\n\ \t[INHERITS (class_name1, ...class_nameN)\n\
\t[[CONSTRAINT name] CHECK condition1, ...conditionN] ]\n\ \t[[CONSTRAINT name] CHECK condition1, ...conditionN] ]\n\
;"}, ;"},
{"create trigger", {"create trigger",
"create a new trigger", "create a new trigger",
"CREATE TRIGGER trigger_name AFTER|BEFORE event1 [OR event2 [OR event3] ]\n\ "\
\tCREATE TRIGGER trigger_name AFTER|BEFORE event1 [OR event2 [OR event3] ]\n\
\tON class_name FOR EACH ROW|STATEMENT\n\ \tON class_name FOR EACH ROW|STATEMENT\n\
\tEXECUTE PROCEDURE func_name ([arguments])\n\ \tEXECUTE PROCEDURE func_name ([arguments])\n\
\n\ \n\
\teventX is one of INSERT, DELETE, UPDATE"}, \teventX is one of INSERT, DELETE, UPDATE"},
{"create type", {"create type",
"create a new user-defined base data type", "create a new user-defined base data type",
"CREATE TYPE typename (\n\ "\
\tCREATE TYPE typename (\n\
\tINTERNALLENGTH = (number|VARIABLE),\n\ \tINTERNALLENGTH = (number|VARIABLE),\n\
\t[EXTERNALLENGTH = (number|VARIABLE),]\n\ \t[EXTERNALLENGTH = (number|VARIABLE),]\n\
\tINPUT = input_function, OUTPUT = output_function\n\ \tINPUT = input_function, OUTPUT = output_function\n\
...@@ -132,7 +148,8 @@ static struct _helpStruct QL_HELP[] = { ...@@ -132,7 +148,8 @@ static struct _helpStruct QL_HELP[] = {
\t[,SEND = send_function][,RECEIVE = receive_function][,PASSEDBYVALUE]);"}, \t[,SEND = send_function][,RECEIVE = receive_function][,PASSEDBYVALUE]);"},
{"create user", {"create user",
"create a new user", "create a new user",
"CREATE USER user_name\n\ "\
\tCREATE USER user_name\n\
\t[WITH PASSWORD password]\n\ \t[WITH PASSWORD password]\n\
\t[CREATEDB | NOCREATEDB]\n\ \t[CREATEDB | NOCREATEDB]\n\
\t[CREATEUSER | NOCREATEUSER]\n\ \t[CREATEUSER | NOCREATEUSER]\n\
...@@ -140,7 +157,8 @@ static struct _helpStruct QL_HELP[] = { ...@@ -140,7 +157,8 @@ static struct _helpStruct QL_HELP[] = {
\t[VALID UNTIL 'abstime'];"}, \t[VALID UNTIL 'abstime'];"},
{"create view", {"create view",
"create a view", "create a view",
"CREATE VIEW view_name AS\n\ "\
\tCREATE VIEW view_name AS\n\
\tSELECT [DISTINCT [ON attrN]]\n\ \tSELECT [DISTINCT [ON attrN]]\n\
\texpr1 [AS attr1], ...exprN\n\ \texpr1 [AS attr1], ...exprN\n\
\t[FROM from_list]\n\ \t[FROM from_list]\n\
...@@ -148,7 +166,8 @@ static struct _helpStruct QL_HELP[] = { ...@@ -148,7 +166,8 @@ static struct _helpStruct QL_HELP[] = {
\t[GROUP BY group_list];"}, \t[GROUP BY group_list];"},
{"declare", {"declare",
"set up a cursor", "set up a cursor",
"DECLARE cursorname [BINARY] CURSOR FOR\n\ "\
\tDECLARE cursorname [BINARY] CURSOR FOR\n\
\tSELECT [DISTINCT [ON attrN]]\n\ \tSELECT [DISTINCT [ON attrN]]\n\
\texpr1 [AS attr1], ...exprN\n\ \texpr1 [AS attr1], ...exprN\n\
\t[FROM from_list]\n\ \t[FROM from_list]\n\
...@@ -159,10 +178,12 @@ static struct _helpStruct QL_HELP[] = { ...@@ -159,10 +178,12 @@ static struct _helpStruct QL_HELP[] = {
\t[UNION [ALL] SELECT ...];"}, \t[UNION [ALL] SELECT ...];"},
{"delete", {"delete",
"delete tuples", "delete tuples",
"DELETE FROM class_name [WHERE qual];"}, "\
\tDELETE FROM class_name [WHERE qual];"},
{"drop", {"drop",
"Please be more specific:", "Please be more specific:",
"\tdrop aggregate\n\ "\
\tdrop aggregate\n\
\tdrop database\n\ \tdrop database\n\
\tdrop function\n\ \tdrop function\n\
\tdrop index\n\ \tdrop index\n\
...@@ -175,57 +196,74 @@ static struct _helpStruct QL_HELP[] = { ...@@ -175,57 +196,74 @@ static struct _helpStruct QL_HELP[] = {
\tdrop view"}, \tdrop view"},
{"drop aggregate", {"drop aggregate",
"remove an aggregate function", "remove an aggregate function",
"DROP AGGREGATE agg_name agg_type|*;"}, "\
\tDROP AGGREGATE agg_name agg_type|*;"},
{"drop database", {"drop database",
"remove a database", "remove a database",
"DROP DATABASE dbname"}, "\
\tDROP DATABASE dbname"},
{"drop function", {"drop function",
"remove a user-defined function", "remove a user-defined function",
"DROP FUNCTION funcname ([type1, ...typeN]);"}, "\
\tDROP FUNCTION funcname ([type1, ...typeN]);"},
{"drop index", {"drop index",
"remove an existing index", "remove an existing index",
"DROP INDEX indexname;"}, "\
\tDROP INDEX indexname;"},
{"drop operator", {"drop operator",
"remove a user-defined operator", "remove a user-defined operator",
"DROP OPERATOR operator_name ([ltype|NONE],[RTYPE|none]);"}, "\
\tDROP OPERATOR operator_name ([ltype|NONE],[RTYPE|none]);"},
{"drop rule", {"drop rule",
"remove a rule", "remove a rule",
"DROP RULE rulename;"}, "\
\tDROP RULE rulename;"},
{"drop sequence", {"drop sequence",
"remove a sequence number generator", "remove a sequence number generator",
"DROP SEQUENCE sequence_name[, ...sequence_nameN];"}, "\
\tDROP SEQUENCE sequence_name[, ...sequence_nameN];"},
{"drop table", {"drop table",
"remove a table", "remove a table",
"DROP TABLE class_name1, ...class_nameN;"}, "\
\tDROP TABLE class_name1, ...class_nameN;"},
{"drop trigger", {"drop trigger",
"remove a trigger", "remove a trigger",
"DROP TRIGGER trigger_name ON class_name;"}, "\
\tDROP TRIGGER trigger_name ON class_name;"},
{"drop type", {"drop type",
"remove a user-defined base type", "remove a user-defined base type",
"DROP TYPE typename;"}, "\
\tDROP TYPE typename;"},
{"drop user", {"drop user",
"remove a user from the system", "remove a user from the system",
"DROP USER user_name;"}, "\
\tDROP USER user_name;"},
{"drop view", {"drop view",
"remove a view", "remove a view",
"DROP VIEW view_name"}, "\
{"end transaction", \tDROP VIEW view_name"},
{"end work",
"end the current transaction", "end the current transaction",
"END [TRANSACTION|WORK];"}, "\
\tEND [WORK|TRANSACTION];"},
{"explain", {"explain",
"explain the query execution plan", "explain the query execution plan",
"EXPLAIN [VERBOSE] query"}, "\
\tEXPLAIN [VERBOSE] query"},
{"fetch", {"fetch",
"retrieve tuples from a cursor", "retrieve tuples from a cursor",
"FETCH [FORWARD|BACKWARD] [number|ALL] [IN cursorname];"}, "\
\tFETCH [FORWARD|BACKWARD] [number|ALL] [IN cursorname];"},
{"grant", {"grant",
"grant access control to a user or group", "grant access control to a user or group",
"GRANT privilege1, ...privilegeN ON rel1, ...relN TO \n\ "\
\tGRANT privilege1, ...privilegeN ON rel1, ...relN TO \n\
[PUBLIC|GROUP group|username]\n\ [PUBLIC|GROUP group|username]\n\
\t privilege is ALL|SELECT|INSERT|UPDATE|DELETE|RULE"}, \t privilege is ALL|SELECT|INSERT|UPDATE|DELETE|RULE"},
{"insert", {"insert",
"insert tuples", "insert tuples",
"INSERT INTO class_name [(attr1, ...attrN)]\n\ "\
\tINSERT INTO class_name [(attr1, ...attrN)]\n\
\tVALUES (expr1,..exprN) |\n\ \tVALUES (expr1,..exprN) |\n\
\tSELECT [DISTINCT [ON attrN]]\n\ \tSELECT [DISTINCT [ON attrN]]\n\
\texpr1, ...exprN\n\ \texpr1, ...exprN\n\
...@@ -236,37 +274,47 @@ static struct _helpStruct QL_HELP[] = { ...@@ -236,37 +274,47 @@ static struct _helpStruct QL_HELP[] = {
\t[UNION [ALL] SELECT ...];"}, \t[UNION [ALL] SELECT ...];"},
{"listen", {"listen",
"listen for notification on a relation", "listen for notification on a relation",
"LISTEN class_name"}, "\
\tLISTEN class_name"},
{"load", {"load",
"dynamically load a module", "dynamically load a module",
"LOAD 'filename';"}, "\
\tLOAD 'filename';"},
{"lock", {"lock",
"exclusive lock a table inside a transaction", "exclusive lock a table inside a transaction",
"LOCK [TABLE] class_name;"}, "\
\tLOCK [TABLE] class_name;"},
{"move", {"move",
"move an cursor position", "move an cursor position",
"MOVE [FORWARD|BACKWARD] [number|ALL] [IN cursorname];"}, "\
\tMOVE [FORWARD|BACKWARD] [number|ALL] [IN cursorname];"},
{"notify", {"notify",
"signal all frontends and backends listening on a relation", "signal all frontends and backends listening on a relation",
"NOTIFY class_name"}, "\
\tNOTIFY class_name"},
{"reset", {"reset",
"set run-time environment back to default", "set run-time environment back to default",
#ifdef MULTIBYTE #ifdef MULTIBYTE
"RESET DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"}, "\
\tRESET DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"},
#else #else
"RESET DateStyle|GEQO|R_PLANS"}, "\
\tRESET DateStyle|GEQO|R_PLANS"},
#endif #endif
{"revoke", {"revoke",
"revoke access control from a user or group", "revoke access control from a user or group",
"REVOKE privilege1, ...privilegeN ON rel1, ...relN FROM \n\ "\
\tREVOKE privilege1, ...privilegeN ON rel1, ...relN FROM \n\
[PUBLIC|GROUP group|username]\n\ [PUBLIC|GROUP group|username]\n\
\t privilege is ALL|SELECT|INSERT|UPDATE|DELETE|RULE"}, \t privilege is ALL|SELECT|INSERT|UPDATE|DELETE|RULE"},
{"rollback", {"rollback work",
"abort a transaction", "abort a transaction",
"ROLLBACK [TRANSACTION|WORK]"}, "\
\tROLLBACK [WORK|TRANSACTION]"},
{"select", {"select",
"retrieve tuples", "retrieve tuples",
"SELECT [DISTINCT [ON attrN]] expr1 [AS attr1], ...exprN\n\ "\
\tSELECT [DISTINCT [ON attrN]] expr1 [AS attr1], ...exprN\n\
\t[INTO [TABLE] class_name]\n\ \t[INTO [TABLE] class_name]\n\
\t[FROM from_list]\n\ \t[FROM from_list]\n\
\t[WHERE qual]\n\ \t[WHERE qual]\n\
...@@ -277,32 +325,38 @@ static struct _helpStruct QL_HELP[] = { ...@@ -277,32 +325,38 @@ static struct _helpStruct QL_HELP[] = {
{"set", {"set",
"set run-time environment", "set run-time environment",
#ifdef MULTIBYTE #ifdef MULTIBYTE
"SET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'\n\ "\
\tSET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'\n\
set GEQO TO 'ON[=#]'|'OFF'\n\ set GEQO TO 'ON[=#]'|'OFF'\n\
set R_PLANS TO 'ON'|'OFF'\n\ set R_PLANS TO 'ON'|'OFF'\n\
set CLIENT_ENCODING TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'"}, set CLIENT_ENCODING TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'"},
#else #else
"SET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'\n\ "\
\tSET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'\n\
set GEQO TO 'ON[=#]'|'OFF'\n\ set GEQO TO 'ON[=#]'|'OFF'\n\
set R_PLANS TO 'ON'| 'OFF'"}, set R_PLANS TO 'ON'| 'OFF'"},
#endif #endif
{"show", {"show",
"show current run-time environment", "show current run-time environment",
#ifdef MULTIBYTE #ifdef MULTIBYTE
"SHOW DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"}, "\
\tSHOW DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"},
#else #else
"SHOW DateStyle|GEQO|R_PLANS"}, "\
\tSHOW DateStyle|GEQO|R_PLANS"},
#endif #endif
{"UPDATE", {"UPDATE",
"update tuples", "update tuples",
"UPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\ "\
\tUPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\
\t [FROM from_clause]\n\ \t [FROM from_clause]\n\
\t[WHERE qual];"}, \t[WHERE qual];"},
{"vacuum", {"vacuum",
"vacuum the database, i.e. cleans out deleted records, updates statistics", "vacuum the database, i.e. cleans out deleted records, updates statistics",
"VACUUM [VERBOSE] [ANALYZE] [table]\n\ "\
\tVACUUM [VERBOSE] [ANALYZE] [table]\n\
\tor\n\ \tor\n\
VACUUM [VERBOSE] ANALYZE [table [(attr1, ...attrN)]];"}, \tVACUUM [VERBOSE] ANALYZE [table [(attr1, ...attrN)]];"},
{NULL, NULL, NULL} /* important to keep a NULL terminator {NULL, NULL, NULL} /* important to keep a NULL terminator
* here! */ * here! */
}; };
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