mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Add TEMP tables/indexes. Add COPY pfree(). Other cleanups.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: analyze.c,v 1.96 1999/01/27 01:18:20 scrappy Exp $
|
||||
* $Id: analyze.c,v 1.97 1999/02/02 03:44:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -924,6 +924,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
|
||||
qry->uniqueFlag = stmt->unique;
|
||||
|
||||
qry->into = stmt->into;
|
||||
qry->isTemp = stmt->istemp;
|
||||
qry->isPortal = FALSE;
|
||||
|
||||
qry->targetList = transformTargetList(pstate, stmt->targetList);
|
||||
@@ -1032,6 +1033,7 @@ transformCursorStmt(ParseState *pstate, SelectStmt *stmt)
|
||||
qry = transformSelectStmt(pstate, stmt);
|
||||
|
||||
qry->into = stmt->portalname;
|
||||
qry->isTemp = stmt->istemp;
|
||||
qry->isPortal = TRUE;
|
||||
qry->isBinary = stmt->binary; /* internal portal */
|
||||
|
||||
@@ -1074,7 +1076,7 @@ create_select_list(Node *ptr, List **select_list, bool *unionall_present)
|
||||
* hands back 'true' */
|
||||
Node *A_Expr_to_Expr(Node *ptr, bool *intersect_present)
|
||||
{
|
||||
Node *result;
|
||||
Node *result = NULL;
|
||||
|
||||
switch(nodeTag(ptr))
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.49 1999/01/25 12:01:13 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.50 1999/02/02 03:44:42 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -154,13 +154,13 @@ Oid param_type(int t); /* used in parse_expr.c */
|
||||
|
||||
%type <str> opt_id, opt_portal_name,
|
||||
all_Op, MathOp, opt_name, opt_unique,
|
||||
result, OptUseOp, opt_class, SpecialRuleRelation
|
||||
OptUseOp, opt_class, SpecialRuleRelation
|
||||
|
||||
%type <str> privileges, operation_commalist, grantee
|
||||
%type <chr> operation, TriggerOneEvent
|
||||
|
||||
%type <list> stmtblock, stmtmulti,
|
||||
relation_name_list, OptTableElementList,
|
||||
result, relation_name_list, OptTableElementList,
|
||||
OptInherit, definition,
|
||||
opt_with, func_args, func_args_list,
|
||||
oper_argtypes, OptStmtList, OptStmtBlock, OptStmtMulti,
|
||||
@@ -173,7 +173,7 @@ Oid param_type(int t); /* used in parse_expr.c */
|
||||
%type <node> func_return
|
||||
%type <boolean> set_opt
|
||||
|
||||
%type <boolean> TriggerForOpt, TriggerForType
|
||||
%type <boolean> TriggerForOpt, TriggerForType, OptTemp
|
||||
|
||||
%type <list> for_update_clause
|
||||
%type <list> join_list
|
||||
@@ -283,7 +283,7 @@ Oid param_type(int t); /* used in parse_expr.c */
|
||||
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC,
|
||||
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
|
||||
SCROLL, SECOND_P, SELECT, SET, SUBSTRING,
|
||||
TABLE, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE,
|
||||
TABLE, TEMP, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE,
|
||||
TO, TRAILING, TRANSACTION, TRIM, TRUE_P,
|
||||
UNION, UNIQUE, UPDATE, USER, USING,
|
||||
VALUES, VARCHAR, VARYING, VIEW,
|
||||
@@ -747,18 +747,23 @@ copy_delimiter: USING DELIMITERS Sconst { $$ = $3; }
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
CreateStmt: CREATE TABLE relation_name '(' OptTableElementList ')'
|
||||
CreateStmt: CREATE OptTemp TABLE relation_name '(' OptTableElementList ')'
|
||||
OptInherit
|
||||
{
|
||||
CreateStmt *n = makeNode(CreateStmt);
|
||||
n->relname = $3;
|
||||
n->tableElts = $5;
|
||||
n->inhRelnames = $7;
|
||||
n->istemp = $2;
|
||||
n->relname = $4;
|
||||
n->tableElts = $6;
|
||||
n->inhRelnames = $8;
|
||||
n->constraints = NIL;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
|
||||
OptTemp: TEMP { $$ = TRUE; }
|
||||
| /*EMPTY*/ { $$ = FALSE; }
|
||||
;
|
||||
|
||||
OptTableElementList: OptTableElementList ',' OptTableElement
|
||||
{
|
||||
if ($3 != NULL)
|
||||
@@ -1236,12 +1241,13 @@ OptInherit: INHERITS '(' relation_name_list ')' { $$ = $3; }
|
||||
| /*EMPTY*/ { $$ = NIL; }
|
||||
;
|
||||
|
||||
CreateAsStmt: CREATE TABLE relation_name OptCreateAs AS SubSelect
|
||||
CreateAsStmt: CREATE OptTemp TABLE relation_name OptCreateAs AS SubSelect
|
||||
{
|
||||
SelectStmt *n = (SelectStmt *)$6;
|
||||
if ($4 != NIL)
|
||||
mapTargetColumns($4, n->targetList);
|
||||
n->into = $3;
|
||||
SelectStmt *n = (SelectStmt *)$7;
|
||||
if ($5 != NIL)
|
||||
mapTargetColumns($5, n->targetList);
|
||||
n->istemp = $2;
|
||||
n->into = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
@@ -2862,8 +2868,9 @@ SubSelect: SELECT opt_unique res_target_list2
|
||||
* want to create a new rule 'SubSelect1' including the
|
||||
* feature. If it makes troubles we will have to add
|
||||
* a new rule and change this to prevent INTOs in
|
||||
* Subselects again */
|
||||
n->into = $4;
|
||||
* Subselects again */
|
||||
n->istemp = (bool)((A_Const *)lfirst($4))->val.val.ival;
|
||||
n->into = (char *)lnext($4);
|
||||
|
||||
n->fromClause = $5;
|
||||
n->whereClause = $6;
|
||||
@@ -2873,8 +2880,9 @@ SubSelect: SELECT opt_unique res_target_list2
|
||||
}
|
||||
;
|
||||
|
||||
result: INTO opt_table relation_name { $$= $3; }
|
||||
| /*EMPTY*/ { $$ = NULL; }
|
||||
/* easy way to return two values. Can someone improve this? bjm */
|
||||
result: INTO OptTemp opt_table relation_name { $$ = lcons(makeInteger($2), (List *)$4); }
|
||||
| /*EMPTY*/ { $$ = lcons(makeInteger(false), NIL); }
|
||||
;
|
||||
|
||||
opt_table: TABLE { $$ = TRUE; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.51 1999/01/18 00:09:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.52 1999/02/02 03:44:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -213,6 +213,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"stdout", STDOUT},
|
||||
{"substring", SUBSTRING},
|
||||
{"table", TABLE},
|
||||
{"temp", TEMP},
|
||||
{"then", THEN},
|
||||
{"time", TIME},
|
||||
{"timestamp", TIMESTAMP},
|
||||
|
||||
@@ -145,110 +145,111 @@ typedef union
|
||||
#define SET 371
|
||||
#define SUBSTRING 372
|
||||
#define TABLE 373
|
||||
#define THEN 374
|
||||
#define TIME 375
|
||||
#define TIMESTAMP 376
|
||||
#define TIMEZONE_HOUR 377
|
||||
#define TIMEZONE_MINUTE 378
|
||||
#define TO 379
|
||||
#define TRAILING 380
|
||||
#define TRANSACTION 381
|
||||
#define TRIM 382
|
||||
#define TRUE_P 383
|
||||
#define UNION 384
|
||||
#define UNIQUE 385
|
||||
#define UPDATE 386
|
||||
#define USER 387
|
||||
#define USING 388
|
||||
#define VALUES 389
|
||||
#define VARCHAR 390
|
||||
#define VARYING 391
|
||||
#define VIEW 392
|
||||
#define WHEN 393
|
||||
#define WHERE 394
|
||||
#define WITH 395
|
||||
#define WORK 396
|
||||
#define YEAR_P 397
|
||||
#define ZONE 398
|
||||
#define TRIGGER 399
|
||||
#define TYPE_P 400
|
||||
#define ABORT_TRANS 401
|
||||
#define AFTER 402
|
||||
#define AGGREGATE 403
|
||||
#define ANALYZE 404
|
||||
#define BACKWARD 405
|
||||
#define BEFORE 406
|
||||
#define BINARY 407
|
||||
#define CACHE 408
|
||||
#define CLUSTER 409
|
||||
#define COPY 410
|
||||
#define CREATEDB 411
|
||||
#define CREATEUSER 412
|
||||
#define CYCLE 413
|
||||
#define DATABASE 414
|
||||
#define DELIMITERS 415
|
||||
#define DO 416
|
||||
#define EACH 417
|
||||
#define ENCODING 418
|
||||
#define EXPLAIN 419
|
||||
#define EXTEND 420
|
||||
#define FORWARD 421
|
||||
#define FUNCTION 422
|
||||
#define HANDLER 423
|
||||
#define INCREMENT 424
|
||||
#define INDEX 425
|
||||
#define INHERITS 426
|
||||
#define INSTEAD 427
|
||||
#define ISNULL 428
|
||||
#define LANCOMPILER 429
|
||||
#define LISTEN 430
|
||||
#define LOAD 431
|
||||
#define LOCATION 432
|
||||
#define LOCK_P 433
|
||||
#define MAXVALUE 434
|
||||
#define MINVALUE 435
|
||||
#define MOVE 436
|
||||
#define NEW 437
|
||||
#define NOCREATEDB 438
|
||||
#define NOCREATEUSER 439
|
||||
#define NONE 440
|
||||
#define NOTHING 441
|
||||
#define NOTIFY 442
|
||||
#define NOTNULL 443
|
||||
#define OIDS 444
|
||||
#define OPERATOR 445
|
||||
#define PASSWORD 446
|
||||
#define PROCEDURAL 447
|
||||
#define RECIPE 448
|
||||
#define RENAME 449
|
||||
#define RESET 450
|
||||
#define RETURNS 451
|
||||
#define ROW 452
|
||||
#define RULE 453
|
||||
#define SEQUENCE 454
|
||||
#define SERIAL 455
|
||||
#define SETOF 456
|
||||
#define SHOW 457
|
||||
#define START 458
|
||||
#define STATEMENT 459
|
||||
#define STDIN 460
|
||||
#define STDOUT 461
|
||||
#define TRUSTED 462
|
||||
#define UNLISTEN 463
|
||||
#define UNTIL 464
|
||||
#define VACUUM 465
|
||||
#define VALID 466
|
||||
#define VERBOSE 467
|
||||
#define VERSION 468
|
||||
#define IDENT 469
|
||||
#define SCONST 470
|
||||
#define Op 471
|
||||
#define ICONST 472
|
||||
#define PARAM 473
|
||||
#define FCONST 474
|
||||
#define OP 475
|
||||
#define UMINUS 476
|
||||
#define TYPECAST 477
|
||||
#define TEMP 374
|
||||
#define THEN 375
|
||||
#define TIME 376
|
||||
#define TIMESTAMP 377
|
||||
#define TIMEZONE_HOUR 378
|
||||
#define TIMEZONE_MINUTE 379
|
||||
#define TO 380
|
||||
#define TRAILING 381
|
||||
#define TRANSACTION 382
|
||||
#define TRIM 383
|
||||
#define TRUE_P 384
|
||||
#define UNION 385
|
||||
#define UNIQUE 386
|
||||
#define UPDATE 387
|
||||
#define USER 388
|
||||
#define USING 389
|
||||
#define VALUES 390
|
||||
#define VARCHAR 391
|
||||
#define VARYING 392
|
||||
#define VIEW 393
|
||||
#define WHEN 394
|
||||
#define WHERE 395
|
||||
#define WITH 396
|
||||
#define WORK 397
|
||||
#define YEAR_P 398
|
||||
#define ZONE 399
|
||||
#define TRIGGER 400
|
||||
#define TYPE_P 401
|
||||
#define ABORT_TRANS 402
|
||||
#define AFTER 403
|
||||
#define AGGREGATE 404
|
||||
#define ANALYZE 405
|
||||
#define BACKWARD 406
|
||||
#define BEFORE 407
|
||||
#define BINARY 408
|
||||
#define CACHE 409
|
||||
#define CLUSTER 410
|
||||
#define COPY 411
|
||||
#define CREATEDB 412
|
||||
#define CREATEUSER 413
|
||||
#define CYCLE 414
|
||||
#define DATABASE 415
|
||||
#define DELIMITERS 416
|
||||
#define DO 417
|
||||
#define EACH 418
|
||||
#define ENCODING 419
|
||||
#define EXPLAIN 420
|
||||
#define EXTEND 421
|
||||
#define FORWARD 422
|
||||
#define FUNCTION 423
|
||||
#define HANDLER 424
|
||||
#define INCREMENT 425
|
||||
#define INDEX 426
|
||||
#define INHERITS 427
|
||||
#define INSTEAD 428
|
||||
#define ISNULL 429
|
||||
#define LANCOMPILER 430
|
||||
#define LISTEN 431
|
||||
#define LOAD 432
|
||||
#define LOCATION 433
|
||||
#define LOCK_P 434
|
||||
#define MAXVALUE 435
|
||||
#define MINVALUE 436
|
||||
#define MOVE 437
|
||||
#define NEW 438
|
||||
#define NOCREATEDB 439
|
||||
#define NOCREATEUSER 440
|
||||
#define NONE 441
|
||||
#define NOTHING 442
|
||||
#define NOTIFY 443
|
||||
#define NOTNULL 444
|
||||
#define OIDS 445
|
||||
#define OPERATOR 446
|
||||
#define PASSWORD 447
|
||||
#define PROCEDURAL 448
|
||||
#define RECIPE 449
|
||||
#define RENAME 450
|
||||
#define RESET 451
|
||||
#define RETURNS 452
|
||||
#define ROW 453
|
||||
#define RULE 454
|
||||
#define SEQUENCE 455
|
||||
#define SERIAL 456
|
||||
#define SETOF 457
|
||||
#define SHOW 458
|
||||
#define START 459
|
||||
#define STATEMENT 460
|
||||
#define STDIN 461
|
||||
#define STDOUT 462
|
||||
#define TRUSTED 463
|
||||
#define UNLISTEN 464
|
||||
#define UNTIL 465
|
||||
#define VACUUM 466
|
||||
#define VALID 467
|
||||
#define VERBOSE 468
|
||||
#define VERSION 469
|
||||
#define IDENT 470
|
||||
#define SCONST 471
|
||||
#define Op 472
|
||||
#define ICONST 473
|
||||
#define PARAM 474
|
||||
#define FCONST 475
|
||||
#define OP 476
|
||||
#define UMINUS 477
|
||||
#define TYPECAST 478
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
Reference in New Issue
Block a user