Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit75c3322

Browse files
author
Michael Meskes
committed
Synced preproc.y and keywords.c.
1 parent3c184d1 commit75c3322

File tree

3 files changed

+87
-55
lines changed

3 files changed

+87
-55
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,11 @@ Sun Apr 14 10:53:14 CEST 2002
12371237
- Fixed one bug in structure handling resulting in using sizeof
12381238
indicator instead of variable.
12391239
- Synced preproc.y with gram.y.
1240+
1241+
Mon Apr 22 20:44:56 CEST 2002
1242+
1243+
- Synced preproc.y with gram.y.
1244+
- Synced keywords.c.
12401245
- Set ecpg version to 2.10.0.
12411246
- Set library version to 3.4.0.
12421247

‎src/interfaces/ecpg/preproc/keywords.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.46 2001/10/15 00:06:04 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.47 2002/04/22 18:54:43 meskes Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -43,6 +43,7 @@ static ScanKeyword ScanKeywords[] = {
4343
{"any",ANY},
4444
{"as",AS},
4545
{"asc",ASC},
46+
{"assertion",ASSERTION},
4647
{"at",AT},
4748
{"authorization",AUTHORIZATION},
4849
{"backward",BACKWARD},
@@ -97,6 +98,7 @@ static ScanKeyword ScanKeywords[] = {
9798
{"desc",DESC},
9899
{"distinct",DISTINCT},
99100
{"do",DO},
101+
{"domain",DOMAIN_P},
100102
{"double",DOUBLE},
101103
{"drop",DROP},
102104
{"each",EACH},
@@ -210,7 +212,6 @@ static ScanKeyword ScanKeywords[] = {
210212
{"privileges",PRIVILEGES},
211213
{"procedural",PROCEDURAL},
212214
{"procedure",PROCEDURE},
213-
{"public",PUBLIC},
214215
{"read",READ},
215216
{"references",REFERENCES},
216217
{"reindex",REINDEX},
@@ -243,6 +244,7 @@ static ScanKeyword ScanKeywords[] = {
243244
{"statistics",STATISTICS},
244245
{"stdin",STDIN},
245246
{"stdout",STDOUT},
247+
{"storage",STORAGE},
246248
{"substring",SUBSTRING},
247249
{"sysid",SYSID},
248250
{"table",TABLE},
@@ -269,6 +271,7 @@ static ScanKeyword ScanKeywords[] = {
269271
{"unlisten",UNLISTEN},
270272
{"until",UNTIL},
271273
{"update",UPDATE},
274+
{"usage",USAGE},
272275
{"user",USER},
273276
{"using",USING},
274277
{"vacuum",VACUUM},

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 77 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ make_name(void)
177177
/* Keywords (in SQL92 reserved words)*/
178178
%tokenABSOLUTE,ACTION,ADD,ALL,ALTER,AND,ANY,AS,ASC,
179179
AT,AUTHORIZATION,BEGIN_TRANS,BETWEEN,BOTH,BY,
180-
CASCADE,CASE,CAST,CHAIN,CHAR,CHARACTER,
181-
CHARACTERISTICS,CHECK,CLOSE,COALESCE,COLLATE,
180+
CASCADE,CASE,CAST,CHAR,CHARACTER,
181+
CHECK,CLOSE,COALESCE,COLLATE,
182182
COLUMN,COMMIT,CONSTRAINT,CONSTRAINTS,CREATE,CROSS,
183183
CURRENT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,
184184
CURRENT_USER,CURSOR,DAY_P,DEC,DECIMAL,DECLARE,
@@ -193,7 +193,7 @@ make_name(void)
193193
NULL_P,NUMERIC,OF,OFF,OLD,ON,ONLY,OPTION,OR,
194194
ORDER,OUT,OUTER_P,OVERLAPS,PARTIAL,PATH_P,
195195
POSITION,PRECISION,PRIMARY,PRIOR,PRIVILEGES,
196-
PROCEDURE,PUBLIC,READ,REFERENCES,RELATIVE,REVOKE,
196+
PROCEDURE,READ,REFERENCES,RELATIVE,REVOKE,
197197
RIGHT,ROLLBACK,SCHEMA,SCROLL,SECOND_P,SELECT,
198198
SESSION,SESSION_USER,SET,SOME,SUBSTRING,TABLE,
199199
TEMPORARY,THEN,TIME,TIMESTAMPTO,TRAILING,
@@ -202,8 +202,9 @@ make_name(void)
202202
VARYING,VIEW,WHEN,WHERE,WITH,WITHOUT,WORK,
203203
YEAR_P,ZONE
204204

205-
/* Keywords (in SQL3 reserved words)*/
206-
%tokenDEFERRABLE,DEFERRED,IMMEDIATE,INITIALLY,PENDANT,
205+
/* Keywords (in SQL99 reserved words)*/
206+
%tokenASSERTION,CHAIN,CHARACTERISTICS,
207+
DEFERRABLE,DEFERRED,IMMEDIATE,INITIALLY,PENDANT,
207208
REPLACE,RESTRICT,TRIGGER
208209

209210
/* Keywords (in SQL92 non-reserved words)*/
@@ -284,8 +285,8 @@ make_name(void)
284285
%type<str>ConstraintElemkey_actionsColQualListtype_nameDropSchemaStmt
285286
%type<str>target_listtarget_elupdate_target_listalias_clause
286287
%type<str>update_target_elopt_idqualified_namedatabase_name
287-
%type<str>access_methodattr_nameclassindex_namenamefunc_name
288-
%type<str>file_nameAexprConstc_exprConstTypename
288+
%type<str>access_methodattr_nameindex_namenamefunc_name
289+
%type<str>file_nameAexprConstc_exprConstTypenamevar_list
289290
%type<str>in_expr_nodesa_exprb_exprTruncateStmtCommentStmt
290291
%type<str>opt_indirectionexpr_listextract_listextract_arg
291292
%type<str>position_listsubstr_listsubstr_fromalter_column_default
@@ -311,7 +312,7 @@ make_name(void)
311312
%type<str>index_opt_uniqueIndexStmtfunc_returnConstInterval
312313
%type<str>func_args_listfunc_argsopt_withProcedureStmtdef_arg
313314
%type<str>def_elemdef_listdefinitionDefineStmtselect_with_parens
314-
%type<str>opt_insteadeventRuleActionListopt_using
315+
%type<str>opt_insteadeventRuleActionListopt_usingCreateAssertStmt
315316
%type<str>RuleActionStmtOrEmptyRuleActionMultifunc_asreindex_type
316317
%type<str>RuleStmtopt_columnopt_nameoper_argtypesNumConst
317318
%type<str>MathOpRemoveFuncStmtaggr_argtypefor_update_clause
@@ -335,7 +336,7 @@ make_name(void)
335336
%type<str>opt_cursorConstraintsSetStmtAllConstCreateDomainStmt
336337
%type<str>case_exprwhen_clause_listcase_defaultcase_argwhen_clause
337338
%type<str>select_clauseopt_select_limitselect_limit_value
338-
%type<str>ConstraintTimeSpecAlterDatabaseSetStmt
339+
%type<str>ConstraintTimeSpecAlterDatabaseSetStmtDropAssertStmt
339340
%type<str>select_offset_valueReindexStmtjoin_typeopt_boolean
340341
%type<str>join_qualupdate_listAlterSchemaStmtjoined_table
341342
%type<str>opt_levelopt_locklock_typeOptGroupListOptGroupElem
@@ -348,7 +349,7 @@ make_name(void)
348349
%type<str>OptSchemaNameOptSchemaEltListschema_stmtopt_drop_behavior
349350
%type<str>handler_nameany_name_listany_nameopt_asinsert_column_list
350351
%type<str>columnrefdotted_namefunction_nameinsert_target_el
351-
%type<str>insert_target_listinsert_column_item
352+
%type<str>insert_target_listinsert_column_itemDropRuleStmt
352353

353354
%type<str>ECPGWheneverECPGConnectconnection_targetECPGOpen
354355
%type<str>indicatorECPGExecuteECPGPrepareecpg_usingecpg_into
@@ -431,6 +432,7 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
431432
|CreateGroupStmt{ output_statement($1,0, connection); }
432433
|CreateSeqStmt{ output_statement($1,0, connection); }
433434
|CreatePLangStmt{ output_statement($1,0, connection); }
435+
|CreateAssertStmt{ output_statement($1,0, connection); }
434436
|CreateTrigStmt{ output_statement($1,0, connection); }
435437
|CreateUserStmt{ output_statement($1,0, connection); }
436438
|ClusterStmt{ output_statement($1,0, connection); }
@@ -440,7 +442,9 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
440442
|TruncateStmt{ output_statement($1,0, connection); }
441443
|DropGroupStmt{ output_statement($1,0, connection); }
442444
|DropPLangStmt{ output_statement($1,0, connection); }
445+
|DropAssertStmt{ output_statement($1,0, connection); }
443446
|DropTrigStmt{ output_statement($1,0, connection); }
447+
|DropRuleStmt{ output_statement($1,0, connection); }
444448
|DropUserStmt{ output_statement($1,0, connection); }
445449
|ExplainStmt{ output_statement($1,0, connection); }
446450
|FetchStmt{ output_statement($1,1, connection); }
@@ -808,9 +812,9 @@ schema_stmt: CreateStmt{ $$ = $1; }
808812
*
809813
*****************************************************************************/
810814

811-
VariableSetStmt:SETColIdTOvar_value
815+
VariableSetStmt:SETColIdTOvar_list
812816
{$$ = cat_str(4, make_str("set"),$2, make_str("to"),$4); }
813-
|SETColId'='var_value
817+
|SETColId'='var_list
814818
{$$ = cat_str(4, make_str("set"),$2, make_str("="),$4); }
815819
|SETTIMEZONEzone_value
816820
{$$ = cat2_str(make_str("set time zone"),$4); }
@@ -824,21 +828,22 @@ VariableSetStmt: SET ColId TO var_value
824828
{$$ = cat2_str(make_str("set session authorization"),$4); }
825829
;
826830

831+
var_list:var_value
832+
{$$ =$1; }
833+
|var_list','var_value
834+
{$$ = cat_str(3,$1, make_str(","),$3); }
835+
|DEFAULT
836+
{$$ = make_str("default"); }
837+
;
838+
827839
opt_level:READCOMMITTED{$$ = make_str("read committed"); }
828840
|SERIALIZABLE{$$ = make_str("serializable"); }
829841
;
830842

831843

832844
var_value:opt_boolean{$$ =$1; }
833-
|AllConst{$$ =$1; }
834-
|name_list
835-
{
836-
if (strlen($1) ==0)
837-
mmerror(PARSE_ERROR, ET_ERROR,"SET must have at least one argument.");
838-
839-
$$ =$1;
840-
}
841-
|DEFAULT{$$ = make_str("default"); }
845+
|NumConst{$$ =$1; }
846+
|ColId_or_Sconst{$$ =$1; }
842847
;
843848

844849
opt_boolean:TRUE_P{$$ = make_str("true"); }
@@ -848,11 +853,15 @@ opt_boolean: TRUE_P{ $$ = make_str("true"); }
848853
;
849854

850855
/* Timezone values can be:
851-
* - a string such as 'pst8pdt'
852-
* - an integer or floating point number
853-
* - a time interval per SQL99
854-
*/
856+
* - a string such as 'pst8pdt'
857+
* - a column identifier such as "pst8pdt"
858+
* - an integer or floating point number
859+
* - a time interval per SQL99
860+
* ConstInterval and ColId give shift/reduce errors,
861+
* so use IDENT and reject anything which is a reserved word.
862+
*/
855863
zone_value:AllConst{$$ =$1; }
864+
|IDENT{$$ =$1; }
856865
|ConstIntervalStringConstopt_interval
857866
{$$ = cat_str(3,$1,$2,$3); }
858867
|ConstInterval'('PosIntConst')'StringConstopt_interval
@@ -1427,6 +1436,29 @@ DropTrigStmt: DROP TRIGGER name ON qualified_name
14271436
{$$ = cat_str(4, make_str("drop trigger"),$3, make_str("on"),$5); }
14281437
;
14291438

1439+
/*****************************************************************************
1440+
*
1441+
* QUERIES :
1442+
* CREATE ASSERTION ...
1443+
* DROP ASSERTION ...
1444+
*
1445+
*****************************************************************************/
1446+
CreateAssertStmt:CREATEASSERTIONname
1447+
CHECK'('a_expr')'ConstraintAttributeSpec
1448+
{
1449+
mmerror(PARSE_ERROR, ET_ERROR,"CREATE ASSERTION is not yet supported");
1450+
$$ = cat_str(6, make_str("create assertion"),$3, make_str("check ("),$6, make_str(")"),$8);
1451+
}
1452+
;
1453+
1454+
DropAssertStmt:DROPASSERTIONname
1455+
{
1456+
mmerror(PARSE_ERROR, ET_ERROR,"DROP ASSERTION is not yet supported");
1457+
$$ = cat2_str(make_str("drop assertion"),$3);
1458+
}
1459+
;
1460+
1461+
14301462
/*****************************************************************************
14311463
*
14321464
*QUERY :
@@ -1476,7 +1508,6 @@ drop_type:TABLE{ $$ = make_str("table"); }
14761508
|SEQUENCE{$$ = make_str("sequence"); }
14771509
|VIEW{$$ = make_str("view"); }
14781510
|INDEX{$$ = make_str("index"); }
1479-
|RULE{$$ = make_str("rule"); }
14801511
|TYPE_P{$$ = make_str("type"); }
14811512
|DOMAIN_P{$$ = make_str("domain"); }
14821513
;
@@ -1563,11 +1594,11 @@ from_in: IN{ $$ = make_str("in"); }
15631594
*The COMMENT ON statement can take different forms based upon the type of
15641595
*the object associated with the comment. The form of the statement is:
15651596
*
1566-
*COMMENT ON [ [ DATABASE | DOMAIN | INDEX |RULE | SEQUENCE | TABLE | TYPE | VIEW ]
1597+
*COMMENT ON [ [ DATABASE | DOMAIN | INDEX | SEQUENCE | TABLE | TYPE | VIEW ]
15671598
* <objname> | AGGREGATE <aggname> (<aggtype>) | FUNCTION
15681599
*<funcname> (arg1, arg2, ...) | OPERATOR <op>
15691600
*(leftoperand_typ rightoperand_typ) | TRIGGER <triggername> ON
1570-
*<relname> ] IS 'text'
1601+
*<relname>| RULE <rulename> ON <relname>] IS 'text'
15711602
*
15721603
*****************************************************************************/
15731604
CommentStmt:COMMENTONcomment_typenameIScomment_text
@@ -1584,11 +1615,14 @@ CommentStmt: COMMENT ON comment_type name IS comment_text
15841615
{$$ = cat_str(6, make_str("comment on operator"),$4, make_str("("),$6, make_str(") is"),$9); }
15851616
|COMMENTONTRIGGERnameONqualified_nameIScomment_text
15861617
{$$ = cat_str(6, make_str("comment on trigger"),$4, make_str("on"),$6, make_str("is"),$8); }
1618+
|COMMENTONRULEnameONany_nameIScomment_text
1619+
{$$ = cat_str(6, make_str("comment on rule"),$4, make_str("on"),$6, make_str("is"),$8); }
1620+
|COMMENTONRULEnameIScomment_text
1621+
{$$ = cat_str(4, make_str("comment on rule"),$4, make_str("is"),$6); }
15871622
;
15881623

15891624
comment_type:DATABASE{$$ = make_str("database"); }
15901625
|INDEX{$$ = make_str("idnex"); }
1591-
|RULE{$$ = make_str("rule"); }
15921626
|SEQUENCE{$$ = make_str("sequence"); }
15931627
|TABLE{$$ = make_str("table"); }
15941628
|DOMAIN_P{$$ = make_str("domain"); }
@@ -1635,6 +1669,9 @@ privilege:SELECT{ $$ = make_str("select"); }
16351669
|TRIGGER{$$ = make_str("trigger"); }
16361670
|EXECUTE{$$ = make_str("execute"); }
16371671
|USAGE{$$ = make_str("usage"); }
1672+
|CREATE{$$ = make_str("create"); }
1673+
|TEMPORARY{$$ = make_str("temporary"); }
1674+
|TEMP{$$ = make_str("temp"); }
16381675
;
16391676

16401677
privilege_target:qualified_name_list
@@ -1643,8 +1680,12 @@ privilege_target: qualified_name_list
16431680
{$$ = cat2_str(make_str("table"),$2); }
16441681
|FUNCTIONfunction_with_argtypes_list
16451682
{$$ = cat2_str(make_str("function"),$2); }
1683+
|DATABASEname_list
1684+
{$$ = cat2_str(make_str("database"),$2); }
16461685
|LANGUAGEname_list
16471686
{$$ = cat2_str(make_str("language") ,$2); }
1687+
|SCHEMAname_list
1688+
{$$ = cat2_str(make_str("schema") ,$2); }
16481689
;
16491690

16501691
grantee_list:grantee
@@ -1653,9 +1694,8 @@ grantee_list: grantee
16531694
{$$ = cat_str(3,$1, make_str(","),$3); }
16541695
;
16551696

1656-
grantee:PUBLIC{$$ =make_str("public"); }
1697+
grantee:ColId{$$ =$1; }
16571698
|GROUPColId{$$ = cat2_str(make_str("group"),$2); }
1658-
|ColId{$$ =$1; }
16591699
;
16601700

16611701
opt_grant_grant_option:WITHGRANTOPTION
@@ -1724,26 +1764,8 @@ index_elem: attr_name opt_class
17241764
{$$ = cat2_str($1,$2); }
17251765
;
17261766

1727-
opt_class:class
1728-
{
1729-
/*
1730-
* Release 7.0 removed network_ops, timespan_ops, and
1731-
* datetime_ops, so we suppress it from being passed to
1732-
* the parser so the default *_ops is used. This can be
1733-
* removed in some later release.bjm 2000/02/07
1734-
*
1735-
* Release 7.1 removes lztext_ops, so suppress that too
1736-
* for a while. tgl 2000/07/30
1737-
*/
1738-
if (strcmp($1,"network_ops") !=0 &&
1739-
strcmp($1,"timespan_ops") != 0 &&
1740-
strcmp($1,"datetime_ops") != 0 &&
1741-
strcmp($1,"lztext_ops") != 0)
1742-
$$ = $1;
1743-
else
1744-
$$ = EMPTY;
1745-
}
1746-
|USINGclass{$$ = cat2_str(make_str("using"),$2); }
1767+
opt_class:any_name {$$ =$1; }
1768+
|USINGany_name{$$ = cat2_str(make_str("using"),$2); }
17471769
|/*EMPTY*/{$$ = EMPTY; }
17481770
;
17491771

@@ -1974,6 +1996,9 @@ opt_instead: INSTEAD{ $$ = make_str("instead"); }
19741996
|/*EMPTY*/{$$ = EMPTY; }
19751997
;
19761998

1999+
DropRuleStmt:DROPRULEnameONqualified_name
2000+
{$$ = cat_str(4, make_str("drop rule"),$3, make_str("on"),$5);}
2001+
;
19772002

19782003
/*****************************************************************************
19792004
*
@@ -3398,7 +3423,6 @@ name:ColId{ $$ = $1; };
33983423
database_name:ColId{$$ =$1; };
33993424
access_method:ColId{$$ =$1; };
34003425
attr_name:ColId{$$ =$1; };
3401-
class:ColId{$$ =$1; };
34023426
index_name:ColId{$$ =$1; };
34033427

34043428
file_name:StringConst{$$ =$1; };
@@ -4780,6 +4804,7 @@ unreserved_keyword:
47804804
|AFTER{$$ = make_str("after"); }
47814805
|AGGREGATE{$$ = make_str("aggregate"); }
47824806
|ALTER{$$ = make_str("alter"); }
4807+
|ASSERTION{$$ = make_str("assertion"); }
47834808
|AT{$$ = make_str("at"); }
47844809
|BACKWARD{$$ = make_str("backward"); }
47854810
|BEFORE{$$ = make_str("before"); }
@@ -4993,7 +5018,6 @@ func_name_keyword:
49935018
|NOTNULL{$$ = make_str("notnull"); }
49945019
|OUTER_P{$$ = make_str("outer"); }
49955020
|OVERLAPS{$$ = make_str("overlaps"); }
4996-
|PUBLIC{$$ = make_str("public"); }
49975021
|RIGHT{$$ = make_str("right"); }
49985022
|VERBOSE{$$ = make_str("verbose"); }
49995023
;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp