mirror of https://github.com/postgres/postgres
Wrap long gram.y lines.
This commit is contained in:
parent
71fd49e28d
commit
8080ac74d5
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.329 2002/06/18 17:27:57 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.330 2002/06/18 17:56:41 momjian Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
|
@ -132,21 +132,26 @@ static void doNegateFloat(Value *v);
|
||||||
}
|
}
|
||||||
|
|
||||||
%type <node> stmt, schema_stmt,
|
%type <node> stmt, schema_stmt,
|
||||||
AlterDatabaseSetStmt, AlterGroupStmt, AlterSchemaStmt, AlterTableStmt,
|
AlterDatabaseSetStmt, AlterGroupStmt, AlterSchemaStmt,
|
||||||
AlterUserStmt, AlterUserSetStmt, AnalyzeStmt,
|
AlterTableStmt, AlterUserStmt, AlterUserSetStmt,
|
||||||
ClosePortalStmt, ClusterStmt, CommentStmt, ConstraintsSetStmt,
|
AnalyzeStmt, ClosePortalStmt, ClusterStmt, CommentStmt,
|
||||||
CopyStmt, CreateAsStmt, CreateDomainStmt, CreateGroupStmt, CreatePLangStmt,
|
ConstraintsSetStmt, CopyStmt, CreateAsStmt,
|
||||||
CreateSchemaStmt, CreateSeqStmt, CreateStmt, CreateAssertStmt, CreateTrigStmt,
|
CreateDomainStmt, CreateGroupStmt, CreatePLangStmt,
|
||||||
CreateUserStmt, CreatedbStmt, CursorStmt, DefineStmt, DeleteStmt,
|
CreateSchemaStmt, CreateSeqStmt, CreateStmt,
|
||||||
DropGroupStmt, DropPLangStmt, DropSchemaStmt, DropStmt, DropAssertStmt, DropTrigStmt,
|
CreateAssertStmt, CreateTrigStmt, CreateUserStmt,
|
||||||
DropRuleStmt, DropUserStmt, DropdbStmt, ExplainStmt, FetchStmt,
|
CreatedbStmt, CursorStmt, DefineStmt, DeleteStmt,
|
||||||
GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt, LockStmt,
|
DropGroupStmt, DropPLangStmt, DropSchemaStmt, DropStmt,
|
||||||
NotifyStmt, OptimizableStmt, CreateFunctionStmt, ReindexStmt,
|
DropAssertStmt, DropTrigStmt, DropRuleStmt,
|
||||||
RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt,
|
DropUserStmt, DropdbStmt, ExplainStmt, FetchStmt,
|
||||||
RenameStmt, RevokeStmt, RuleActionStmt, RuleActionStmtOrEmpty,
|
GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt,
|
||||||
RuleStmt, SelectStmt, TransactionStmt, TruncateStmt,
|
LockStmt, NotifyStmt, OptimizableStmt,
|
||||||
UnlistenStmt, UpdateStmt, VacuumStmt, VariableResetStmt,
|
CreateFunctionStmt, ReindexStmt, RemoveAggrStmt,
|
||||||
VariableSetStmt, VariableShowStmt, ViewStmt, CheckPointStmt
|
RemoveFuncStmt, RemoveOperStmt, RenameStmt, RevokeStmt,
|
||||||
|
RuleActionStmt, RuleActionStmtOrEmpty, RuleStmt,
|
||||||
|
SelectStmt, TransactionStmt, TruncateStmt,
|
||||||
|
UnlistenStmt, UpdateStmt, VacuumStmt,
|
||||||
|
VariableResetStmt, VariableSetStmt, VariableShowStmt,
|
||||||
|
ViewStmt, CheckPointStmt
|
||||||
|
|
||||||
%type <node> select_no_parens, select_with_parens, select_clause,
|
%type <node> select_no_parens, select_with_parens, select_clause,
|
||||||
simple_select
|
simple_select
|
||||||
|
@ -316,69 +321,82 @@ static void doNegateFloat(Value *v);
|
||||||
|
|
||||||
/* ordinary key words in alphabetical order */
|
/* ordinary key words in alphabetical order */
|
||||||
%token <keyword> ABORT_TRANS, ABSOLUTE, ACCESS, ACTION, ADD, AFTER,
|
%token <keyword> ABORT_TRANS, ABSOLUTE, ACCESS, ACTION, ADD, AFTER,
|
||||||
AGGREGATE, ALL, ALTER, ANALYSE, ANALYZE, AND, ANY, AS, ASC, ASSERTION,
|
AGGREGATE, ALL, ALTER, ANALYSE, ANALYZE, AND, ANY, AS, ASC,
|
||||||
AT, AUTHORIZATION,
|
ASSERTION, AT, AUTHORIZATION,
|
||||||
|
|
||||||
BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
|
BACKWARD, BEFORE, BEGIN_TRANS, BETWEEN, BIGINT, BINARY, BIT, BOTH,
|
||||||
BOOLEAN, BY,
|
BOOLEAN, BY,
|
||||||
|
|
||||||
CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P, CHARACTER,
|
CACHE, CALLED, CASCADE, CASE, CAST, CHAIN, CHAR_P,
|
||||||
CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE, CLUSTER, COALESCE, COLLATE,
|
CHARACTER, CHARACTERISTICS, CHECK, CHECKPOINT, CLOSE,
|
||||||
COLUMN, COMMENT, COMMIT, COMMITTED, CONSTRAINT, CONSTRAINTS, COPY,
|
CLUSTER, COALESCE, COLLATE, COLUMN, COMMENT, COMMIT,
|
||||||
CREATE, CREATEDB, CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
|
COMMITTED, CONSTRAINT, CONSTRAINTS, COPY, CREATE, CREATEDB,
|
||||||
|
CREATEUSER, CROSS, CURRENT_DATE, CURRENT_TIME,
|
||||||
CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,
|
CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE,
|
||||||
|
|
||||||
DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT, DEFERRABLE, DEFERRED,
|
DATABASE, DAY_P, DEC, DECIMAL, DECLARE, DEFAULT,
|
||||||
DEFINER, DELETE_P, DELIMITERS, DESC, DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,
|
DEFERRABLE, DEFERRED, DEFINER, DELETE_P, DELIMITERS, DESC,
|
||||||
|
DISTINCT, DO, DOMAIN_P, DOUBLE, DROP,
|
||||||
|
|
||||||
EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT, EXCLUSIVE,
|
EACH, ELSE, ENCODING, ENCRYPTED, END_TRANS, ESCAPE, EXCEPT,
|
||||||
EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,
|
EXCLUSIVE, EXECUTE, EXISTS, EXPLAIN, EXTERNAL, EXTRACT,
|
||||||
|
|
||||||
FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM,
|
FALSE_P, FETCH, FLOAT_P, FOR, FORCE, FOREIGN, FORWARD,
|
||||||
FULL, FUNCTION,
|
FREEZE, FROM, FULL, FUNCTION,
|
||||||
|
|
||||||
GET, GLOBAL, GRANT, GROUP_P,
|
GET, GLOBAL, GRANT, GROUP_P,
|
||||||
|
|
||||||
HANDLER, HAVING, HOUR_P,
|
HANDLER, HAVING, HOUR_P,
|
||||||
|
|
||||||
ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT, INDEX, INHERITS,
|
ILIKE, IMMEDIATE, IMMUTABLE, IMPLICIT, IN_P, INCREMENT,
|
||||||
INITIALLY, INNER_P, INOUT, INPUT, INSENSITIVE, INSERT, INSTEAD, INT,
|
INDEX, INHERITS, INITIALLY, INNER_P, INOUT, INPUT,
|
||||||
INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,
|
INSENSITIVE, INSERT, INSTEAD, INT, INTEGER, INTERSECT,
|
||||||
|
INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION,
|
||||||
|
|
||||||
JOIN,
|
JOIN,
|
||||||
KEY,
|
KEY,
|
||||||
|
|
||||||
LANCOMPILER, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LIMIT, LISTEN,
|
LANCOMPILER, LANGUAGE, LEADING, LEFT, LEVEL, LIKE, LIMIT,
|
||||||
LOAD, LOCAL, LOCALTIME, LOCALTIMESTAMP, LOCATION, LOCK_P,
|
LISTEN, LOAD, LOCAL, LOCALTIME, LOCALTIMESTAMP, LOCATION,
|
||||||
|
LOCK_P,
|
||||||
|
|
||||||
MATCH, MAXVALUE, MINUTE_P, MINVALUE, MODE, MONTH_P, MOVE,
|
MATCH, MAXVALUE, MINUTE_P, MINVALUE, MODE, MONTH_P, MOVE,
|
||||||
|
|
||||||
NAMES, NATIONAL, NATURAL, NCHAR, NEW, NEXT, NO, NOCREATEDB,
|
NAMES, NATIONAL, NATURAL, NCHAR, NEW, NEXT, NO, NOCREATEDB,
|
||||||
NOCREATEUSER, NONE, NOT, NOTHING, NOTIFY, NOTNULL, NULL_P, NULLIF,
|
NOCREATEUSER, NONE, NOT, NOTHING, NOTIFY, NOTNULL, NULL_P,
|
||||||
NUMERIC,
|
NULLIF, NUMERIC,
|
||||||
|
|
||||||
OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR, ORDER,
|
OF, OFF, OFFSET, OIDS, OLD, ON, ONLY, OPERATOR, OPTION, OR,
|
||||||
OUT_P, OUTER_P, OVERLAPS, OVERLAY, OWNER,
|
ORDER, OUT_P, OUTER_P, OVERLAPS, OVERLAY, OWNER,
|
||||||
|
|
||||||
PARTIAL, PASSWORD, PATH_P, PENDANT, PLACING, POSITION, PRECISION, PRIMARY,
|
PARTIAL, PASSWORD, PATH_P, PENDANT, PLACING, POSITION,
|
||||||
PRIOR, PRIVILEGES, PROCEDURE, PROCEDURAL,
|
PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE,
|
||||||
|
PROCEDURAL,
|
||||||
|
|
||||||
READ, REAL, REFERENCES, REINDEX, RELATIVE, RENAME, REPLACE, RESET,
|
READ, REAL, REFERENCES, REINDEX, RELATIVE, RENAME, REPLACE,
|
||||||
RESTRICT, RETURNS, REVOKE, RIGHT, ROLLBACK, ROW, RULE,
|
RESET, RESTRICT, RETURNS, REVOKE, RIGHT, ROLLBACK, ROW,
|
||||||
|
RULE,
|
||||||
|
|
||||||
SCHEMA, SCROLL, SECOND_P, SECURITY, SELECT, SEQUENCE, SERIALIZABLE,
|
SCHEMA, SCROLL, SECOND_P, SECURITY, SELECT, SEQUENCE,
|
||||||
SESSION, SESSION_USER, SET, SETOF, SHARE, SHOW, SIMILAR, SMALLINT, SOME,
|
SERIALIZABLE, SESSION, SESSION_USER, SET, SETOF, SHARE,
|
||||||
STABLE, START, STATEMENT, STATISTICS, STDIN, STDOUT, STORAGE, STRICT,
|
SHOW, SIMILAR, SMALLINT, SOME, STABLE, START, STATEMENT,
|
||||||
SUBSTRING, SYSID,
|
STATISTICS, STDIN, STDOUT, STORAGE, STRICT, SUBSTRING,
|
||||||
|
SYSID,
|
||||||
|
|
||||||
TABLE, TEMP, TEMPLATE, TEMPORARY, THEN, TIME, TIMESTAMP, TO, TOAST,
|
TABLE, TEMP, TEMPLATE, TEMPORARY, THEN, TIME, TIMESTAMP,
|
||||||
TRAILING, TRANSACTION, TRIGGER, TRIM, TRUE_P, TRUNCATE, TRUSTED, TYPE_P,
|
TO, TOAST, TRAILING, TRANSACTION, TRIGGER, TRIM, TRUE_P,
|
||||||
|
TRUNCATE, TRUSTED, TYPE_P,
|
||||||
|
|
||||||
UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UNLISTEN, UNTIL, UPDATE, USAGE,
|
UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UNLISTEN, UNTIL,
|
||||||
USER, USING,
|
UPDATE, USAGE, USER, USING,
|
||||||
|
|
||||||
|
VACUUM, VALID, VALIDATOR, VALUES, VARCHAR, VARYING,
|
||||||
|
VERBOSE, VERSION, VIEW, VOLATILE,
|
||||||
|
|
||||||
VACUUM, VALID, VALIDATOR, VALUES, VARCHAR, VARYING, VERBOSE, VERSION, VIEW, VOLATILE,
|
|
||||||
WHEN, WHERE, WITH, WITHOUT, WORK,
|
WHEN, WHERE, WITH, WITHOUT, WORK,
|
||||||
|
|
||||||
YEAR_P,
|
YEAR_P,
|
||||||
|
|
||||||
ZONE
|
ZONE
|
||||||
|
|
||||||
/* The grammar thinks these are keywords, but they are not in the keywords.c
|
/* The grammar thinks these are keywords, but they are not in the keywords.c
|
||||||
|
@ -412,7 +430,7 @@ static void doNegateFloat(Value *v);
|
||||||
%left Op OPERATOR /* multi-character ops and user-defined operators */
|
%left Op OPERATOR /* multi-character ops and user-defined operators */
|
||||||
%nonassoc NOTNULL
|
%nonassoc NOTNULL
|
||||||
%nonassoc ISNULL
|
%nonassoc ISNULL
|
||||||
%nonassoc IS NULL_P TRUE_P FALSE_P UNKNOWN /* sets precedence for IS NULL, etc */
|
%nonassoc IS NULL_P TRUE_P FALSE_P UNKNOWN /* sets precedence for IS NULL, etc */
|
||||||
%left '+' '-'
|
%left '+' '-'
|
||||||
%left '*' '/' '%'
|
%left '*' '/' '%'
|
||||||
%left '^'
|
%left '^'
|
||||||
|
@ -758,7 +776,7 @@ CreateSchemaStmt:
|
||||||
CREATE SCHEMA OptSchemaName AUTHORIZATION UserId OptSchemaEltList
|
CREATE SCHEMA OptSchemaName AUTHORIZATION UserId OptSchemaEltList
|
||||||
{
|
{
|
||||||
CreateSchemaStmt *n = makeNode(CreateSchemaStmt);
|
CreateSchemaStmt *n = makeNode(CreateSchemaStmt);
|
||||||
/* One can omit the schema name or the authorization id... */
|
/* One can omit the schema name or the authorization id. */
|
||||||
if ($3 != NULL)
|
if ($3 != NULL)
|
||||||
n->schemaname = $3;
|
n->schemaname = $3;
|
||||||
else
|
else
|
||||||
|
@ -955,7 +973,7 @@ zone_value:
|
||||||
{
|
{
|
||||||
if (($3 & ~(MASK(HOUR) | MASK(MINUTE))) != 0)
|
if (($3 & ~(MASK(HOUR) | MASK(MINUTE))) != 0)
|
||||||
elog(ERROR,
|
elog(ERROR,
|
||||||
"Time zone interval must be HOUR or HOUR TO MINUTE");
|
"Time zone interval must be HOUR or HOUR TO MINUTE");
|
||||||
n->typename->typmod = ((($3 & 0x7FFF) << 16) | 0xFFFF);
|
n->typename->typmod = ((($3 & 0x7FFF) << 16) | 0xFFFF);
|
||||||
}
|
}
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
@ -971,7 +989,7 @@ zone_value:
|
||||||
{
|
{
|
||||||
if (($6 & ~(MASK(HOUR) | MASK(MINUTE))) != 0)
|
if (($6 & ~(MASK(HOUR) | MASK(MINUTE))) != 0)
|
||||||
elog(ERROR,
|
elog(ERROR,
|
||||||
"Time zone interval must be HOUR or HOUR TO MINUTE");
|
"Time zone interval must be HOUR or HOUR TO MINUTE");
|
||||||
n->typename->typmod = ((($6 & 0x7FFF) << 16) | $3);
|
n->typename->typmod = ((($6 & 0x7FFF) << 16) | $3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1114,8 +1132,11 @@ AlterTableStmt:
|
||||||
n->def = $6;
|
n->def = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> ALTER [COLUMN] <colname> {SET DEFAULT <expr>|DROP DEFAULT} */
|
/* ALTER TABLE <relation> ALTER [COLUMN] <colname>
|
||||||
| ALTER TABLE relation_expr ALTER opt_column ColId alter_column_default
|
* {SET DEFAULT <expr>|DROP DEFAULT}
|
||||||
|
*/
|
||||||
|
| ALTER TABLE relation_expr ALTER opt_column
|
||||||
|
ColId alter_column_default
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
n->subtype = 'T';
|
n->subtype = 'T';
|
||||||
|
@ -1124,8 +1145,11 @@ AlterTableStmt:
|
||||||
n->def = $7;
|
n->def = $7;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> ALTER [COLUMN] <colname> DROP NOT NULL */
|
/* ALTER TABLE <relation> ALTER [COLUMN] <colname>
|
||||||
| ALTER TABLE relation_expr ALTER opt_column ColId DROP NOT NULL_P
|
* DROP NOT NULL
|
||||||
|
*/
|
||||||
|
| ALTER TABLE relation_expr ALTER opt_column
|
||||||
|
ColId DROP NOT NULL_P
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
n->subtype = 'N';
|
n->subtype = 'N';
|
||||||
|
@ -1133,8 +1157,11 @@ AlterTableStmt:
|
||||||
n->name = $6;
|
n->name = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> ALTER [COLUMN] <colname> SET NOT NULL */
|
/* ALTER TABLE <relation> ALTER [COLUMN] <colname>
|
||||||
| ALTER TABLE relation_expr ALTER opt_column ColId SET NOT NULL_P
|
* SET NOT NULL
|
||||||
|
*/
|
||||||
|
| ALTER TABLE relation_expr ALTER opt_column ColId
|
||||||
|
SET NOT NULL_P
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
n->subtype = 'O';
|
n->subtype = 'O';
|
||||||
|
@ -1142,8 +1169,11 @@ AlterTableStmt:
|
||||||
n->name = $6;
|
n->name = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> ALTER [COLUMN] <colname> SET STATISTICS <Iconst> */
|
/* ALTER TABLE <relation> ALTER [COLUMN] <colname>
|
||||||
| ALTER TABLE relation_expr ALTER opt_column ColId SET STATISTICS Iconst
|
* SET STATISTICS <Iconst>
|
||||||
|
*/
|
||||||
|
| ALTER TABLE relation_expr ALTER opt_column ColId
|
||||||
|
SET STATISTICS Iconst
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
n->subtype = 'S';
|
n->subtype = 'S';
|
||||||
|
@ -1152,8 +1182,11 @@ AlterTableStmt:
|
||||||
n->def = (Node *) makeInteger($9);
|
n->def = (Node *) makeInteger($9);
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> ALTER [COLUMN] <colname> SET STORAGE <storagemode> */
|
/* ALTER TABLE <relation> ALTER [COLUMN] <colname>
|
||||||
| ALTER TABLE relation_expr ALTER opt_column ColId SET STORAGE ColId
|
* SET STORAGE <storagemode>
|
||||||
|
*/
|
||||||
|
| ALTER TABLE relation_expr ALTER opt_column ColId
|
||||||
|
SET STORAGE ColId
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
n->subtype = 'M';
|
n->subtype = 'M';
|
||||||
|
@ -1162,7 +1195,9 @@ AlterTableStmt:
|
||||||
n->def = (Node *) makeString($9);
|
n->def = (Node *) makeString($9);
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> DROP [COLUMN] <colname> {RESTRICT|CASCADE} */
|
/* ALTER TABLE <relation> DROP [COLUMN] <colname>
|
||||||
|
* {RESTRICT|CASCADE}
|
||||||
|
*/
|
||||||
| ALTER TABLE relation_expr DROP opt_column ColId drop_behavior
|
| ALTER TABLE relation_expr DROP opt_column ColId drop_behavior
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
|
@ -1181,7 +1216,9 @@ AlterTableStmt:
|
||||||
n->def = $5;
|
n->def = $5;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
/* ALTER TABLE <relation> DROP CONSTRAINT <name> {RESTRICT|CASCADE} */
|
/* ALTER TABLE <relation> DROP CONSTRAINT <name>
|
||||||
|
* {RESTRICT|CASCADE}
|
||||||
|
*/
|
||||||
| ALTER TABLE relation_expr DROP CONSTRAINT name drop_behavior
|
| ALTER TABLE relation_expr DROP CONSTRAINT name drop_behavior
|
||||||
{
|
{
|
||||||
AlterTableStmt *n = makeNode(AlterTableStmt);
|
AlterTableStmt *n = makeNode(AlterTableStmt);
|
||||||
|
@ -1327,7 +1364,8 @@ copy_null: WITH NULL_P AS Sconst { $$ = $4; }
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' OptInherit OptWithOids
|
CreateStmt: CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')'
|
||||||
|
OptInherit OptWithOids
|
||||||
{
|
{
|
||||||
CreateStmt *n = makeNode(CreateStmt);
|
CreateStmt *n = makeNode(CreateStmt);
|
||||||
$4->istemp = $2;
|
$4->istemp = $2;
|
||||||
|
@ -1350,12 +1388,14 @@ OptTemp: TEMPORARY { $$ = TRUE; }
|
||||||
| LOCAL TEMP { $$ = TRUE; }
|
| LOCAL TEMP { $$ = TRUE; }
|
||||||
| GLOBAL TEMPORARY
|
| GLOBAL TEMPORARY
|
||||||
{
|
{
|
||||||
elog(ERROR, "GLOBAL TEMPORARY TABLE is not currently supported");
|
elog(ERROR,
|
||||||
|
"GLOBAL TEMPORARY TABLE is not currently supported");
|
||||||
$$ = TRUE;
|
$$ = TRUE;
|
||||||
}
|
}
|
||||||
| GLOBAL TEMP
|
| GLOBAL TEMP
|
||||||
{
|
{
|
||||||
elog(ERROR, "GLOBAL TEMPORARY TABLE is not currently supported");
|
elog(ERROR,
|
||||||
|
"GLOBAL TEMPORARY TABLE is not currently supported");
|
||||||
$$ = TRUE;
|
$$ = TRUE;
|
||||||
}
|
}
|
||||||
| /*EMPTY*/ { $$ = FALSE; }
|
| /*EMPTY*/ { $$ = FALSE; }
|
||||||
|
@ -1392,8 +1432,9 @@ columnDef: ColId Typename ColQualList opt_collate
|
||||||
n->constraints = $3;
|
n->constraints = $3;
|
||||||
|
|
||||||
if ($4 != NULL)
|
if ($4 != NULL)
|
||||||
elog(NOTICE, "CREATE TABLE / COLLATE %s not yet implemented"
|
elog(NOTICE,
|
||||||
"; clause ignored", $4);
|
"CREATE TABLE / COLLATE %s not yet implemented; "
|
||||||
|
"clause ignored", $4);
|
||||||
|
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1668,8 @@ ConstraintElem:
|
||||||
n->keys = $4;
|
n->keys = $4;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| FOREIGN KEY '(' columnList ')' REFERENCES qualified_name opt_column_list
|
| FOREIGN KEY '(' columnList ')' REFERENCES qualified_name
|
||||||
|
opt_column_list
|
||||||
key_match key_actions ConstraintAttributeSpec
|
key_match key_actions ConstraintAttributeSpec
|
||||||
{
|
{
|
||||||
FkConstraint *n = makeNode(FkConstraint);
|
FkConstraint *n = makeNode(FkConstraint);
|
||||||
|
@ -1681,18 +1723,20 @@ key_actions:
|
||||||
| /*EMPTY*/ { $$ = 0; }
|
| /*EMPTY*/ { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
key_delete: ON DELETE_P key_reference { $$ = $3 << FKCONSTR_ON_DELETE_SHIFT; }
|
key_delete: ON DELETE_P key_reference
|
||||||
|
{ $$ = $3 << FKCONSTR_ON_DELETE_SHIFT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
key_update: ON UPDATE key_reference { $$ = $3 << FKCONSTR_ON_UPDATE_SHIFT; }
|
key_update: ON UPDATE key_reference
|
||||||
|
{ $$ = $3 << FKCONSTR_ON_UPDATE_SHIFT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
key_reference:
|
key_reference:
|
||||||
NO ACTION { $$ = FKCONSTR_ON_KEY_NOACTION; }
|
NO ACTION { $$ = FKCONSTR_ON_KEY_NOACTION; }
|
||||||
| RESTRICT { $$ = FKCONSTR_ON_KEY_RESTRICT; }
|
| RESTRICT { $$ = FKCONSTR_ON_KEY_RESTRICT; }
|
||||||
| CASCADE { $$ = FKCONSTR_ON_KEY_CASCADE; }
|
| CASCADE { $$ = FKCONSTR_ON_KEY_CASCADE; }
|
||||||
| SET NULL_P { $$ = FKCONSTR_ON_KEY_SETNULL; }
|
| SET NULL_P { $$ = FKCONSTR_ON_KEY_SETNULL; }
|
||||||
| SET DEFAULT { $$ = FKCONSTR_ON_KEY_SETDEFAULT; }
|
| SET DEFAULT { $$ = FKCONSTR_ON_KEY_SETDEFAULT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
OptInherit: INHERITS '(' qualified_name_list ')' { $$ = $3; }
|
OptInherit: INHERITS '(' qualified_name_list ')' { $$ = $3; }
|
||||||
|
@ -1873,7 +1917,8 @@ opt_trusted:
|
||||||
* Work around by using name and dotted_name separately.
|
* Work around by using name and dotted_name separately.
|
||||||
*/
|
*/
|
||||||
handler_name:
|
handler_name:
|
||||||
name { $$ = makeList1(makeString($1)); }
|
name
|
||||||
|
{ $$ = makeList1(makeString($1)); }
|
||||||
| dotted_name { $$ = $1; }
|
| dotted_name { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -2038,7 +2083,8 @@ ConstraintAttributeSpec:
|
||||||
| ConstraintDeferrabilitySpec ConstraintTimeSpec
|
| ConstraintDeferrabilitySpec ConstraintTimeSpec
|
||||||
{
|
{
|
||||||
if ($1 == 0 && $2 != 0)
|
if ($1 == 0 && $2 != 0)
|
||||||
elog(ERROR, "INITIALLY DEFERRED constraint must be DEFERRABLE");
|
elog(ERROR,
|
||||||
|
"INITIALLY DEFERRED constraint must be DEFERRABLE");
|
||||||
$$ = $1 | $2;
|
$$ = $1 | $2;
|
||||||
}
|
}
|
||||||
| ConstraintTimeSpec
|
| ConstraintTimeSpec
|
||||||
|
@ -2051,7 +2097,8 @@ ConstraintAttributeSpec:
|
||||||
| ConstraintTimeSpec ConstraintDeferrabilitySpec
|
| ConstraintTimeSpec ConstraintDeferrabilitySpec
|
||||||
{
|
{
|
||||||
if ($2 == 0 && $1 != 0)
|
if ($2 == 0 && $1 != 0)
|
||||||
elog(ERROR, "INITIALLY DEFERRED constraint must be DEFERRABLE");
|
elog(ERROR,
|
||||||
|
"INITIALLY DEFERRED constraint must be DEFERRABLE");
|
||||||
$$ = $1 | $2;
|
$$ = $1 | $2;
|
||||||
}
|
}
|
||||||
| /*EMPTY*/
|
| /*EMPTY*/
|
||||||
|
@ -2090,7 +2137,8 @@ DropTrigStmt:
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
CreateAssertStmt:
|
CreateAssertStmt:
|
||||||
CREATE ASSERTION name CHECK '(' a_expr ')' ConstraintAttributeSpec
|
CREATE ASSERTION name CHECK '(' a_expr ')'
|
||||||
|
ConstraintAttributeSpec
|
||||||
{
|
{
|
||||||
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
CreateTrigStmt *n = makeNode(CreateTrigStmt);
|
||||||
n->trigname = $3;
|
n->trigname = $3;
|
||||||
|
@ -2182,10 +2230,10 @@ def_elem: ColLabel '=' def_arg
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Note: any simple identifier will be returned as a type name! */
|
/* Note: any simple identifier will be returned as a type name! */
|
||||||
def_arg: func_return { $$ = (Node *)$1; }
|
def_arg: func_return { $$ = (Node *)$1; }
|
||||||
| all_Op { $$ = (Node *)makeString($1); }
|
| all_Op { $$ = (Node *)makeString($1); }
|
||||||
| NumericOnly { $$ = (Node *)$1; }
|
| NumericOnly { $$ = (Node *)$1; }
|
||||||
| Sconst { $$ = (Node *)makeString($1); }
|
| Sconst { $$ = (Node *)makeString($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2220,8 +2268,8 @@ any_name_list:
|
||||||
| any_name_list ',' any_name { $$ = lappend($1, $3); }
|
| any_name_list ',' any_name { $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
any_name: ColId { $$ = makeList1(makeString($1)); }
|
any_name: ColId { $$ = makeList1(makeString($1)); }
|
||||||
| dotted_name { $$ = $1; }
|
| dotted_name { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -2263,7 +2311,8 @@ CommentStmt:
|
||||||
n->comment = $6;
|
n->comment = $6;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
| COMMENT ON AGGREGATE func_name '(' aggr_argtype ')' IS comment_text
|
| COMMENT ON AGGREGATE func_name '(' aggr_argtype ')'
|
||||||
|
IS comment_text
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = AGGREGATE;
|
n->objtype = AGGREGATE;
|
||||||
|
@ -2281,7 +2330,8 @@ CommentStmt:
|
||||||
n->comment = $7;
|
n->comment = $7;
|
||||||
$$ = (Node *) n;
|
$$ = (Node *) n;
|
||||||
}
|
}
|
||||||
| COMMENT ON OPERATOR any_operator '(' oper_argtypes ')' IS comment_text
|
| COMMENT ON OPERATOR any_operator '(' oper_argtypes ')'
|
||||||
|
IS comment_text
|
||||||
{
|
{
|
||||||
CommentStmt *n = makeNode(CommentStmt);
|
CommentStmt *n = makeNode(CommentStmt);
|
||||||
n->objtype = OPERATOR;
|
n->objtype = OPERATOR;
|
||||||
|
@ -2352,7 +2402,8 @@ FetchStmt: FETCH direction fetch_how_many from_in name
|
||||||
if ($2 == RELATIVE)
|
if ($2 == RELATIVE)
|
||||||
{
|
{
|
||||||
if ($3 == 0)
|
if ($3 == 0)
|
||||||
elog(ERROR,"FETCH / RELATIVE at current position is not supported");
|
elog(ERROR,
|
||||||
|
"FETCH / RELATIVE at current position is not supported");
|
||||||
$2 = FORWARD;
|
$2 = FORWARD;
|
||||||
}
|
}
|
||||||
if ($3 < 0)
|
if ($3 < 0)
|
||||||
|
@ -2479,7 +2530,8 @@ direction: FORWARD { $$ = FORWARD; }
|
||||||
| RELATIVE { $$ = RELATIVE; }
|
| RELATIVE { $$ = RELATIVE; }
|
||||||
| ABSOLUTE
|
| ABSOLUTE
|
||||||
{
|
{
|
||||||
elog(NOTICE,"FETCH / ABSOLUTE not supported, using RELATIVE");
|
elog(NOTICE,
|
||||||
|
"FETCH / ABSOLUTE not supported, using RELATIVE");
|
||||||
$$ = RELATIVE;
|
$$ = RELATIVE;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -2487,7 +2539,8 @@ direction: FORWARD { $$ = FORWARD; }
|
||||||
fetch_how_many:
|
fetch_how_many:
|
||||||
Iconst { $$ = $1; }
|
Iconst { $$ = $1; }
|
||||||
| '-' Iconst { $$ = - $2; }
|
| '-' Iconst { $$ = - $2; }
|
||||||
| ALL { $$ = 0; /* 0 means fetch all tuples*/ }
|
/* 0 means fetch all tuples*/
|
||||||
|
| ALL { $$ = 0; }
|
||||||
| NEXT { $$ = 1; }
|
| NEXT { $$ = 1; }
|
||||||
| PRIOR { $$ = -1; }
|
| PRIOR { $$ = -1; }
|
||||||
;
|
;
|
||||||
|
@ -2503,7 +2556,8 @@ from_in: IN_P {}
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
GrantStmt: GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_option
|
GrantStmt: GRANT privileges ON privilege_target TO grantee_list
|
||||||
|
opt_grant_grant_option
|
||||||
{
|
{
|
||||||
GrantStmt *n = makeNode(GrantStmt);
|
GrantStmt *n = makeNode(GrantStmt);
|
||||||
n->is_grant = true;
|
n->is_grant = true;
|
||||||
|
@ -2515,7 +2569,8 @@ GrantStmt: GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
RevokeStmt: REVOKE opt_revoke_grant_option privileges ON privilege_target FROM grantee_list
|
RevokeStmt: REVOKE opt_revoke_grant_option privileges ON privilege_target
|
||||||
|
FROM grantee_list
|
||||||
{
|
{
|
||||||
GrantStmt *n = makeNode(GrantStmt);
|
GrantStmt *n = makeNode(GrantStmt);
|
||||||
n->is_grant = false;
|
n->is_grant = false;
|
||||||
|
@ -2529,9 +2584,9 @@ RevokeStmt: REVOKE opt_revoke_grant_option privileges ON privilege_target FROM g
|
||||||
|
|
||||||
|
|
||||||
/* either ALL [PRIVILEGES] or a list of individual privileges */
|
/* either ALL [PRIVILEGES] or a list of individual privileges */
|
||||||
privileges: privilege_list { $$ = $1; }
|
privileges: privilege_list { $$ = $1; }
|
||||||
| ALL { $$ = makeListi1(ACL_ALL_RIGHTS); }
|
| ALL { $$ = makeListi1(ACL_ALL_RIGHTS); }
|
||||||
| ALL PRIVILEGES { $$ = makeListi1(ACL_ALL_RIGHTS); }
|
| ALL PRIVILEGES { $$ = makeListi1(ACL_ALL_RIGHTS); }
|
||||||
;
|
;
|
||||||
|
|
||||||
privilege_list:
|
privilege_list:
|
||||||
|
@ -2613,7 +2668,7 @@ grantee_list:
|
||||||
grantee: ColId
|
grantee: ColId
|
||||||
{
|
{
|
||||||
PrivGrantee *n = makeNode(PrivGrantee);
|
PrivGrantee *n = makeNode(PrivGrantee);
|
||||||
/* This hack lets us avoid reserving PUBLIC as a keyword */
|
/* This hack lets us avoid reserving PUBLIC as a keyword*/
|
||||||
if (strcmp($1, "public") == 0)
|
if (strcmp($1, "public") == 0)
|
||||||
n->username = NULL;
|
n->username = NULL;
|
||||||
else
|
else
|
||||||
|
@ -2838,12 +2893,14 @@ func_arg: opt_arg func_type
|
||||||
opt_arg: IN_P { $$ = FALSE; }
|
opt_arg: IN_P { $$ = FALSE; }
|
||||||
| OUT_P
|
| OUT_P
|
||||||
{
|
{
|
||||||
elog(ERROR, "CREATE FUNCTION / OUT parameters are not supported");
|
elog(ERROR,
|
||||||
|
"CREATE FUNCTION / OUT parameters are not supported");
|
||||||
$$ = TRUE;
|
$$ = TRUE;
|
||||||
}
|
}
|
||||||
| INOUT
|
| INOUT
|
||||||
{
|
{
|
||||||
elog(ERROR, "CREATE FUNCTION / INOUT parameters are not supported");
|
elog(ERROR,
|
||||||
|
"CREATE FUNCTION / INOUT parameters are not supported");
|
||||||
$$ = FALSE;
|
$$ = FALSE;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
@ -2961,8 +3018,11 @@ createfunc_opt_item:
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
func_as: Sconst { $$ = makeList1(makeString($1)); }
|
func_as: Sconst { $$ = makeList1(makeString($1)); }
|
||||||
| Sconst ',' Sconst { $$ = makeList2(makeString($1), makeString($3)); }
|
| Sconst ',' Sconst
|
||||||
|
{
|
||||||
|
$$ = makeList2(makeString($1), makeString($3));
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_definition:
|
opt_definition:
|
||||||
|
@ -3021,14 +3081,19 @@ oper_argtypes:
|
||||||
{
|
{
|
||||||
elog(ERROR,"parser: argument type missing (use NONE for unary operators)");
|
elog(ERROR,"parser: argument type missing (use NONE for unary operators)");
|
||||||
}
|
}
|
||||||
| Typename ',' Typename { $$ = makeList2($1, $3); }
|
| Typename ',' Typename
|
||||||
| NONE ',' Typename /* left unary */ { $$ = makeList2(NULL, $3); }
|
{ $$ = makeList2($1, $3); }
|
||||||
| Typename ',' NONE /* right unary */ { $$ = makeList2($1, NULL); }
|
| NONE ',' Typename /* left unary */
|
||||||
|
{ $$ = makeList2(NULL, $3); }
|
||||||
|
| Typename ',' NONE /* right unary */
|
||||||
|
{ $$ = makeList2($1, NULL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
any_operator:
|
any_operator:
|
||||||
all_Op { $$ = makeList1(makeString($1)); }
|
all_Op
|
||||||
| ColId '.' any_operator { $$ = lcons(makeString($1), $3); }
|
{ $$ = makeList1(makeString($1)); }
|
||||||
|
| ColId '.' any_operator
|
||||||
|
{ $$ = lcons(makeString($1), $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3732,7 +3797,8 @@ insert_rest:
|
||||||
|
|
||||||
insert_column_list:
|
insert_column_list:
|
||||||
insert_column_item { $$ = makeList1($1); }
|
insert_column_item { $$ = makeList1($1); }
|
||||||
| insert_column_list ',' insert_column_item { $$ = lappend($1, $3); }
|
| insert_column_list ',' insert_column_item
|
||||||
|
{ $$ = lappend($1, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
insert_column_item:
|
insert_column_item:
|
||||||
|
@ -3773,18 +3839,18 @@ LockStmt: LOCK_P opt_table qualified_name_list opt_lock
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_lock: IN_P lock_type MODE { $$ = $2; }
|
opt_lock: IN_P lock_type MODE { $$ = $2; }
|
||||||
| /*EMPTY*/ { $$ = AccessExclusiveLock; }
|
| /*EMPTY*/ { $$ = AccessExclusiveLock; }
|
||||||
;
|
;
|
||||||
|
|
||||||
lock_type: ACCESS SHARE { $$ = AccessShareLock; }
|
lock_type: ACCESS SHARE { $$ = AccessShareLock; }
|
||||||
| ROW SHARE { $$ = RowShareLock; }
|
| ROW SHARE { $$ = RowShareLock; }
|
||||||
| ROW EXCLUSIVE { $$ = RowExclusiveLock; }
|
| ROW EXCLUSIVE { $$ = RowExclusiveLock; }
|
||||||
| SHARE UPDATE EXCLUSIVE { $$ = ShareUpdateExclusiveLock; }
|
| SHARE UPDATE EXCLUSIVE { $$ = ShareUpdateExclusiveLock; }
|
||||||
| SHARE { $$ = ShareLock; }
|
| SHARE { $$ = ShareLock; }
|
||||||
| SHARE ROW EXCLUSIVE { $$ = ShareRowExclusiveLock; }
|
| SHARE ROW EXCLUSIVE { $$ = ShareRowExclusiveLock; }
|
||||||
| EXCLUSIVE { $$ = ExclusiveLock; }
|
| EXCLUSIVE { $$ = ExclusiveLock; }
|
||||||
| ACCESS EXCLUSIVE { $$ = AccessExclusiveLock; }
|
| ACCESS EXCLUSIVE { $$ = AccessExclusiveLock; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3998,13 +4064,15 @@ OptTempTableName:
|
||||||
}
|
}
|
||||||
| GLOBAL TEMPORARY opt_table qualified_name
|
| GLOBAL TEMPORARY opt_table qualified_name
|
||||||
{
|
{
|
||||||
elog(ERROR, "GLOBAL TEMPORARY TABLE is not currently supported");
|
elog(ERROR,
|
||||||
|
"GLOBAL TEMPORARY TABLE is not currently supported");
|
||||||
$$ = $4;
|
$$ = $4;
|
||||||
$$->istemp = true;
|
$$->istemp = true;
|
||||||
}
|
}
|
||||||
| GLOBAL TEMP opt_table qualified_name
|
| GLOBAL TEMP opt_table qualified_name
|
||||||
{
|
{
|
||||||
elog(ERROR, "GLOBAL TEMPORARY TABLE is not currently supported");
|
elog(ERROR,
|
||||||
|
"GLOBAL TEMPORARY TABLE is not currently supported");
|
||||||
$$ = $4;
|
$$ = $4;
|
||||||
$$->istemp = true;
|
$$->istemp = true;
|
||||||
}
|
}
|
||||||
|
@ -4076,13 +4144,15 @@ select_limit:
|
||||||
{ $$ = makeList2($2, NULL); }
|
{ $$ = makeList2($2, NULL); }
|
||||||
| LIMIT select_limit_value ',' select_offset_value
|
| LIMIT select_limit_value ',' select_offset_value
|
||||||
/* Disabled because it was too confusing, bjm 2002-02-18 */
|
/* Disabled because it was too confusing, bjm 2002-02-18 */
|
||||||
{ elog(ERROR, "LIMIT #,# syntax not supported.\n\tUse separate LIMIT and OFFSET clauses."); }
|
{ elog(ERROR,
|
||||||
|
"LIMIT #,# syntax not supported.\n\tUse separate LIMIT and OFFSET clauses."); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
opt_select_limit:
|
opt_select_limit:
|
||||||
select_limit { $$ = $1; }
|
select_limit { $$ = $1; }
|
||||||
| /* EMPTY */ { $$ = makeList2(NULL,NULL); }
|
| /* EMPTY */
|
||||||
|
{ $$ = makeList2(NULL,NULL); }
|
||||||
;
|
;
|
||||||
|
|
||||||
select_limit_value:
|
select_limit_value:
|
||||||
|
@ -4469,7 +4539,8 @@ func_table: func_name '(' ')'
|
||||||
|
|
||||||
where_clause:
|
where_clause:
|
||||||
WHERE a_expr { $$ = $2; }
|
WHERE a_expr { $$ = $2; }
|
||||||
| /*EMPTY*/ { $$ = NULL; /* no qualifiers */ }
|
/* no qualifiers */
|
||||||
|
| /*EMPTY*/ { $$ = NULL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4524,7 +4595,8 @@ SimpleTypename:
|
||||||
{
|
{
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
if (($3 < 0) || ($3 > MAX_INTERVAL_PRECISION))
|
if (($3 < 0) || ($3 > MAX_INTERVAL_PRECISION))
|
||||||
elog(ERROR, "INTERVAL(%d) precision must be between %d and %d",
|
elog(ERROR,
|
||||||
|
"INTERVAL(%d) precision must be between %d and %d",
|
||||||
$3, 0, MAX_INTERVAL_PRECISION);
|
$3, 0, MAX_INTERVAL_PRECISION);
|
||||||
$$->typmod = ((($5 & 0x7FFF) << 16) | $3);
|
$$->typmod = ((($5 & 0x7FFF) << 16) | $3);
|
||||||
}
|
}
|
||||||
|
@ -4608,13 +4680,15 @@ Numeric: INT
|
||||||
opt_float: '(' Iconst ')'
|
opt_float: '(' Iconst ')'
|
||||||
{
|
{
|
||||||
if ($2 < 1)
|
if ($2 < 1)
|
||||||
elog(ERROR, "precision for FLOAT must be at least 1");
|
elog(ERROR,
|
||||||
|
"precision for FLOAT must be at least 1");
|
||||||
else if ($2 < 7)
|
else if ($2 < 7)
|
||||||
$$ = SystemTypeName("float4");
|
$$ = SystemTypeName("float4");
|
||||||
else if ($2 < 16)
|
else if ($2 < 16)
|
||||||
$$ = SystemTypeName("float8");
|
$$ = SystemTypeName("float8");
|
||||||
else
|
else
|
||||||
elog(ERROR, "precision for FLOAT must be less than 16");
|
elog(ERROR,
|
||||||
|
"precision for FLOAT must be less than 16");
|
||||||
}
|
}
|
||||||
| /*EMPTY*/
|
| /*EMPTY*/
|
||||||
{
|
{
|
||||||
|
@ -4626,10 +4700,12 @@ opt_numeric:
|
||||||
'(' Iconst ',' Iconst ')'
|
'(' Iconst ',' Iconst ')'
|
||||||
{
|
{
|
||||||
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
||||||
elog(ERROR, "NUMERIC precision %d must be between 1 and %d",
|
elog(ERROR,
|
||||||
|
"NUMERIC precision %d must be between 1 and %d",
|
||||||
$2, NUMERIC_MAX_PRECISION);
|
$2, NUMERIC_MAX_PRECISION);
|
||||||
if ($4 < 0 || $4 > $2)
|
if ($4 < 0 || $4 > $2)
|
||||||
elog(ERROR, "NUMERIC scale %d must be between 0 and precision %d",
|
elog(ERROR,
|
||||||
|
"NUMERIC scale %d must be between 0 and precision %d",
|
||||||
$4,$2);
|
$4,$2);
|
||||||
|
|
||||||
$$ = (($2 << 16) | $4) + VARHDRSZ;
|
$$ = (($2 << 16) | $4) + VARHDRSZ;
|
||||||
|
@ -4637,7 +4713,8 @@ opt_numeric:
|
||||||
| '(' Iconst ')'
|
| '(' Iconst ')'
|
||||||
{
|
{
|
||||||
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
||||||
elog(ERROR, "NUMERIC precision %d must be between 1 and %d",
|
elog(ERROR,
|
||||||
|
"NUMERIC precision %d must be between 1 and %d",
|
||||||
$2, NUMERIC_MAX_PRECISION);
|
$2, NUMERIC_MAX_PRECISION);
|
||||||
|
|
||||||
$$ = ($2 << 16) + VARHDRSZ;
|
$$ = ($2 << 16) + VARHDRSZ;
|
||||||
|
@ -4653,10 +4730,12 @@ opt_decimal:
|
||||||
'(' Iconst ',' Iconst ')'
|
'(' Iconst ',' Iconst ')'
|
||||||
{
|
{
|
||||||
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
||||||
elog(ERROR, "DECIMAL precision %d must be between 1 and %d",
|
elog(ERROR,
|
||||||
|
"DECIMAL precision %d must be between 1 and %d",
|
||||||
$2, NUMERIC_MAX_PRECISION);
|
$2, NUMERIC_MAX_PRECISION);
|
||||||
if ($4 < 0 || $4 > $2)
|
if ($4 < 0 || $4 > $2)
|
||||||
elog(ERROR, "DECIMAL scale %d must be between 0 and precision %d",
|
elog(ERROR,
|
||||||
|
"DECIMAL scale %d must be between 0 and precision %d",
|
||||||
$4,$2);
|
$4,$2);
|
||||||
|
|
||||||
$$ = (($2 << 16) | $4) + VARHDRSZ;
|
$$ = (($2 << 16) | $4) + VARHDRSZ;
|
||||||
|
@ -4664,7 +4743,8 @@ opt_decimal:
|
||||||
| '(' Iconst ')'
|
| '(' Iconst ')'
|
||||||
{
|
{
|
||||||
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
if ($2 < 1 || $2 > NUMERIC_MAX_PRECISION)
|
||||||
elog(ERROR, "DECIMAL precision %d must be between 1 and %d",
|
elog(ERROR,
|
||||||
|
"DECIMAL precision %d must be between 1 and %d",
|
||||||
$2, NUMERIC_MAX_PRECISION);
|
$2, NUMERIC_MAX_PRECISION);
|
||||||
|
|
||||||
$$ = ($2 << 16) + VARHDRSZ;
|
$$ = ($2 << 16) + VARHDRSZ;
|
||||||
|
@ -4809,8 +4889,10 @@ ConstDatetime:
|
||||||
*/
|
*/
|
||||||
$$->timezone = $5;
|
$$->timezone = $5;
|
||||||
if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
|
if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
|
||||||
elog(ERROR, "TIMESTAMP(%d)%s precision must be between %d and %d",
|
elog(ERROR,
|
||||||
$3, ($5 ? " WITH TIME ZONE": ""), 0, MAX_TIMESTAMP_PRECISION);
|
"TIMESTAMP(%d)%s precision must be between %d and %d",
|
||||||
|
$3, ($5 ? " WITH TIME ZONE": ""), 0,
|
||||||
|
MAX_TIMESTAMP_PRECISION);
|
||||||
$$->typmod = $3;
|
$$->typmod = $3;
|
||||||
}
|
}
|
||||||
| TIMESTAMP opt_timezone
|
| TIMESTAMP opt_timezone
|
||||||
|
@ -4839,8 +4921,10 @@ ConstDatetime:
|
||||||
else
|
else
|
||||||
$$ = SystemTypeName("time");
|
$$ = SystemTypeName("time");
|
||||||
if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
|
if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
|
||||||
elog(ERROR, "TIME(%d)%s precision must be between %d and %d",
|
elog(ERROR,
|
||||||
$3, ($5 ? " WITH TIME ZONE": ""), 0, MAX_TIME_PRECISION);
|
"TIME(%d)%s precision must be between %d and %d",
|
||||||
|
$3, ($5 ? " WITH TIME ZONE": ""), 0,
|
||||||
|
MAX_TIME_PRECISION);
|
||||||
$$->typmod = $3;
|
$$->typmod = $3;
|
||||||
}
|
}
|
||||||
| TIME opt_timezone
|
| TIME opt_timezone
|
||||||
|
@ -4874,13 +4958,20 @@ opt_interval:
|
||||||
| HOUR_P { $$ = MASK(HOUR); }
|
| HOUR_P { $$ = MASK(HOUR); }
|
||||||
| MINUTE_P { $$ = MASK(MINUTE); }
|
| MINUTE_P { $$ = MASK(MINUTE); }
|
||||||
| SECOND_P { $$ = MASK(SECOND); }
|
| SECOND_P { $$ = MASK(SECOND); }
|
||||||
| YEAR_P TO MONTH_P { $$ = MASK(YEAR) | MASK(MONTH); }
|
| YEAR_P TO MONTH_P
|
||||||
| DAY_P TO HOUR_P { $$ = MASK(DAY) | MASK(HOUR); }
|
{ $$ = MASK(YEAR) | MASK(MONTH); }
|
||||||
| DAY_P TO MINUTE_P { $$ = MASK(DAY) | MASK(HOUR) | MASK(MINUTE); }
|
| DAY_P TO HOUR_P
|
||||||
| DAY_P TO SECOND_P { $$ = MASK(DAY) | MASK(HOUR) | MASK(MINUTE) | MASK(SECOND); }
|
{ $$ = MASK(DAY) | MASK(HOUR); }
|
||||||
| HOUR_P TO MINUTE_P { $$ = MASK(HOUR) | MASK(MINUTE); }
|
| DAY_P TO MINUTE_P
|
||||||
| HOUR_P TO SECOND_P { $$ = MASK(HOUR) | MASK(MINUTE) | MASK(SECOND); }
|
{ $$ = MASK(DAY) | MASK(HOUR) | MASK(MINUTE); }
|
||||||
| MINUTE_P TO SECOND_P { $$ = MASK(MINUTE) | MASK(SECOND); }
|
| DAY_P TO SECOND_P
|
||||||
|
{ $$ = MASK(DAY) | MASK(HOUR) | MASK(MINUTE) | MASK(SECOND); }
|
||||||
|
| HOUR_P TO MINUTE_P
|
||||||
|
{ $$ = MASK(HOUR) | MASK(MINUTE); }
|
||||||
|
| HOUR_P TO SECOND_P
|
||||||
|
{ $$ = MASK(HOUR) | MASK(MINUTE) | MASK(SECOND); }
|
||||||
|
| MINUTE_P TO SECOND_P
|
||||||
|
{ $$ = MASK(MINUTE) | MASK(SECOND); }
|
||||||
| /*EMPTY*/ { $$ = -1; }
|
| /*EMPTY*/ { $$ = -1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -4915,7 +5006,8 @@ row_expr: '(' row_descriptor ')' IN_P select_with_parens
|
||||||
n->subselect = $6;
|
n->subselect = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| '(' row_descriptor ')' qual_all_Op sub_type select_with_parens %prec Op
|
| '(' row_descriptor ')' qual_all_Op sub_type select_with_parens
|
||||||
|
%prec Op
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = $2;
|
n->lefthand = $2;
|
||||||
|
@ -4928,7 +5020,8 @@ row_expr: '(' row_descriptor ')' IN_P select_with_parens
|
||||||
n->subselect = $6;
|
n->subselect = $6;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| '(' row_descriptor ')' qual_all_Op select_with_parens %prec Op
|
| '(' row_descriptor ')' qual_all_Op select_with_parens
|
||||||
|
%prec Op
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = $2;
|
n->lefthand = $2;
|
||||||
|
@ -4941,7 +5034,8 @@ row_expr: '(' row_descriptor ')' IN_P select_with_parens
|
||||||
n->subselect = $5;
|
n->subselect = $5;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| '(' row_descriptor ')' qual_all_Op '(' row_descriptor ')' %prec Op
|
| '(' row_descriptor ')' qual_all_Op '(' row_descriptor ')'
|
||||||
|
%prec Op
|
||||||
{
|
{
|
||||||
$$ = makeRowExpr($4, $2, $6);
|
$$ = makeRowExpr($4, $2, $6);
|
||||||
}
|
}
|
||||||
|
@ -4996,12 +5090,14 @@ MathOp: '+' { $$ = "+"; }
|
||||||
| '=' { $$ = "="; }
|
| '=' { $$ = "="; }
|
||||||
;
|
;
|
||||||
|
|
||||||
qual_Op: Op { $$ = makeList1(makeString($1)); }
|
qual_Op: Op
|
||||||
|
{ $$ = makeList1(makeString($1)); }
|
||||||
| OPERATOR '(' any_operator ')' { $$ = $3; }
|
| OPERATOR '(' any_operator ')' { $$ = $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
qual_all_Op:
|
qual_all_Op:
|
||||||
all_Op { $$ = makeList1(makeString($1)); }
|
all_Op
|
||||||
|
{ $$ = makeList1(makeString($1)); }
|
||||||
| OPERATOR '(' any_operator ')' { $$ = $3; }
|
| OPERATOR '(' any_operator ')' { $$ = $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -5022,7 +5118,8 @@ qual_all_Op:
|
||||||
* it's factored out just to eliminate redundant coding.
|
* it's factored out just to eliminate redundant coding.
|
||||||
*/
|
*/
|
||||||
a_expr: c_expr { $$ = $1; }
|
a_expr: c_expr { $$ = $1; }
|
||||||
| a_expr TYPECAST Typename { $$ = makeTypeCast($1, $3); }
|
| a_expr TYPECAST Typename
|
||||||
|
{ $$ = makeTypeCast($1, $3); }
|
||||||
| a_expr COLLATE ColId
|
| a_expr COLLATE ColId
|
||||||
{
|
{
|
||||||
FuncCall *n = makeNode(FuncCall);
|
FuncCall *n = makeNode(FuncCall);
|
||||||
|
@ -5325,7 +5422,7 @@ a_expr: c_expr { $$ = $1; }
|
||||||
$$ = n;
|
$$ = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| a_expr qual_all_Op sub_type select_with_parens %prec Op
|
| a_expr qual_all_Op sub_type select_with_parens %prec Op
|
||||||
{
|
{
|
||||||
SubLink *n = makeNode(SubLink);
|
SubLink *n = makeNode(SubLink);
|
||||||
n->lefthand = makeList1($1);
|
n->lefthand = makeList1($1);
|
||||||
|
@ -5553,7 +5650,8 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
s->typename = SystemTypeName("text");
|
s->typename = SystemTypeName("text");
|
||||||
d = SystemTypeName("timetz");
|
d = SystemTypeName("timetz");
|
||||||
if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
|
if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
|
||||||
elog(ERROR, "CURRENT_TIME(%d) precision must be between %d and %d",
|
elog(ERROR,
|
||||||
|
"CURRENT_TIME(%d) precision must be between %d and %d",
|
||||||
$3, 0, MAX_TIME_PRECISION);
|
$3, 0, MAX_TIME_PRECISION);
|
||||||
d->typmod = $3;
|
d->typmod = $3;
|
||||||
|
|
||||||
|
@ -5597,7 +5695,9 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
|
|
||||||
d = SystemTypeName("timestamptz");
|
d = SystemTypeName("timestamptz");
|
||||||
if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
|
if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
|
||||||
elog(ERROR, "CURRENT_TIMESTAMP(%d) precision must be between %d and %d",
|
elog(ERROR,
|
||||||
|
"CURRENT_TIMESTAMP(%d) precision "
|
||||||
|
"must be between %d and %d",
|
||||||
$3, 0, MAX_TIMESTAMP_PRECISION);
|
$3, 0, MAX_TIMESTAMP_PRECISION);
|
||||||
d->typmod = $3;
|
d->typmod = $3;
|
||||||
|
|
||||||
|
@ -5640,7 +5740,8 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
s->typename = SystemTypeName("text");
|
s->typename = SystemTypeName("text");
|
||||||
d = SystemTypeName("time");
|
d = SystemTypeName("time");
|
||||||
if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
|
if (($3 < 0) || ($3 > MAX_TIME_PRECISION))
|
||||||
elog(ERROR, "LOCALTIME(%d) precision must be between %d and %d",
|
elog(ERROR,
|
||||||
|
"LOCALTIME(%d) precision must be between %d and %d",
|
||||||
$3, 0, MAX_TIME_PRECISION);
|
$3, 0, MAX_TIME_PRECISION);
|
||||||
d->typmod = $3;
|
d->typmod = $3;
|
||||||
|
|
||||||
|
@ -5684,7 +5785,9 @@ c_expr: columnref { $$ = (Node *) $1; }
|
||||||
|
|
||||||
d = SystemTypeName("timestamp");
|
d = SystemTypeName("timestamp");
|
||||||
if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
|
if (($3 < 0) || ($3 > MAX_TIMESTAMP_PRECISION))
|
||||||
elog(ERROR, "LOCALTIMESTAMP(%d) precision must be between %d and %d",
|
elog(ERROR,
|
||||||
|
"LOCALTIMESTAMP(%d) precision must be "
|
||||||
|
"between %d and %d",
|
||||||
$3, 0, MAX_TIMESTAMP_PRECISION);
|
$3, 0, MAX_TIMESTAMP_PRECISION);
|
||||||
d->typmod = $3;
|
d->typmod = $3;
|
||||||
|
|
||||||
|
@ -6066,12 +6169,16 @@ columnref: relation_name opt_indirection
|
||||||
;
|
;
|
||||||
|
|
||||||
dotted_name:
|
dotted_name:
|
||||||
relation_name attrs { $$ = lcons(makeString($1), $2); }
|
relation_name attrs
|
||||||
|
{ $$ = lcons(makeString($1), $2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
attrs: '.' attr_name { $$ = makeList1(makeString($2)); }
|
attrs: '.' attr_name
|
||||||
| '.' '*' { $$ = makeList1(makeString("*")); }
|
{ $$ = makeList1(makeString($2)); }
|
||||||
| '.' attr_name attrs { $$ = lcons(makeString($2), $3); }
|
| '.' '*'
|
||||||
|
{ $$ = makeList1(makeString("*")); }
|
||||||
|
| '.' attr_name attrs
|
||||||
|
{ $$ = lcons(makeString($2), $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -6194,15 +6301,19 @@ qualified_name:
|
||||||
$$->relname = strVal(lfirst(lnext(lnext($1))));
|
$$->relname = strVal(lfirst(lnext(lnext($1))));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "Improper qualified name (too many dotted names): %s",
|
elog(ERROR,
|
||||||
|
"Improper qualified name "
|
||||||
|
"(too many dotted names): %s",
|
||||||
NameListToString($1));
|
NameListToString($1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
name_list: name { $$ = makeList1(makeString($1)); }
|
name_list: name
|
||||||
| name_list ',' name { $$ = lappend($1, makeString($3)); }
|
{ $$ = makeList1(makeString($1)); }
|
||||||
|
| name_list ',' name
|
||||||
|
{ $$ = lappend($1, makeString($3)); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -6220,7 +6331,8 @@ index_name: ColId { $$ = $1; };
|
||||||
|
|
||||||
file_name: Sconst { $$ = $1; };
|
file_name: Sconst { $$ = $1; };
|
||||||
|
|
||||||
func_name: function_name { $$ = makeList1(makeString($1)); }
|
func_name: function_name
|
||||||
|
{ $$ = makeList1(makeString($1)); }
|
||||||
| dotted_name { $$ = $1; }
|
| dotted_name { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -6289,7 +6401,8 @@ AexprConst: Iconst
|
||||||
n->val.val.str = $5;
|
n->val.val.str = $5;
|
||||||
/* precision specified, and fields may be... */
|
/* precision specified, and fields may be... */
|
||||||
if (($3 < 0) || ($3 > MAX_INTERVAL_PRECISION))
|
if (($3 < 0) || ($3 > MAX_INTERVAL_PRECISION))
|
||||||
elog(ERROR, "INTERVAL(%d) precision must be between %d and %d",
|
elog(ERROR,
|
||||||
|
"INTERVAL(%d) precision must be between %d and %d",
|
||||||
$3, 0, MAX_INTERVAL_PRECISION);
|
$3, 0, MAX_INTERVAL_PRECISION);
|
||||||
n->typename->typmod = ((($6 & 0x7FFF) << 16) | $3);
|
n->typename->typmod = ((($6 & 0x7FFF) << 16) | $3);
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
|
|
Loading…
Reference in New Issue