1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-30 06:01:21 +03:00

Refactor ecpg grammar so that it uses the core grammar's unreserved_keyword

list, minus a few specific words that have to be treated specially.  This
replaces a hard-wired list of keywords that would have needed manual
maintenance, and was not getting it.  The 8.4 coding was already missing
these words, causing ecpg to incorrectly treat them as reserved words:
CALLED, CATALOG, DEFINER, ENUM, FOLLOWING, INVOKER, OPTIONS, PARTITION,
PRECEDING, RANGE, SECURITY, SERVER, UNBOUNDED, WRAPPER.  In HEAD we were
additionally missing COMMENTS, FUNCTIONS, SEQUENCES, TABLES.
Per gripe from Bosco Rama.
This commit is contained in:
Tom Lane
2009-11-21 05:44:05 +00:00
parent 7fc0f06221
commit e6c63bf660
3 changed files with 104 additions and 296 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/parse.pl,v 1.4 2009/11/05 23:24:27 tgl Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/parse.pl,v 1.5 2009/11/21 05:44:05 tgl Exp $
# parser generater for ecpg
# call with backend parser as stdin
#
@@ -51,18 +51,31 @@ $replace_types{'stmtblock'} = 'ignore';
$replace_types{'stmtmulti'} = 'ignore';
$replace_types{'CreateAsStmt'} = 'ignore';
$replace_types{'DeallocateStmt'} = 'ignore';
$replace_types{'ColId'} = 'ignore';
$replace_types{'type_function_name'} = 'ignore';
$replace_types{'ColLabel'} = 'ignore';
$replace_types{'unreserved_keyword'} = 'ignore';
$replace_types{'Sconst'} = 'ignore';
# some production rules have to be ignored or replaced
$replace_line{'fetch_direction'} = 'ignore';
$replace_line{"opt_array_boundsopt_array_bounds'['Iconst']'"} = 'ignore';
# these replace_line commands excise certain keywords from the core keyword
# lists. Be sure to account for these in ColLabel and related productions.
$replace_line{'unreserved_keywordCONNECTION'} = 'ignore';
$replace_line{'unreserved_keywordCURRENT_P'} = 'ignore';
$replace_line{'unreserved_keywordDAY_P'} = 'ignore';
$replace_line{'unreserved_keywordHOUR_P'} = 'ignore';
$replace_line{'unreserved_keywordINPUT_P'} = 'ignore';
$replace_line{'unreserved_keywordMINUTE_P'} = 'ignore';
$replace_line{'unreserved_keywordMONTH_P'} = 'ignore';
$replace_line{'unreserved_keywordSECOND_P'} = 'ignore';
$replace_line{'unreserved_keywordYEAR_P'} = 'ignore';
$replace_line{'col_name_keywordCHAR_P'} = 'ignore';
$replace_line{'col_name_keywordINT_P'} = 'ignore';
$replace_line{'col_name_keywordVALUES'} = 'ignore';
$replace_line{'reserved_keywordTO'} = 'ignore';
$replace_line{'reserved_keywordUNION'} = 'ignore';
# some other production rules have to be ignored or replaced
$replace_line{'fetch_direction'} = 'ignore';
$replace_line{"opt_array_boundsopt_array_bounds'['Iconst']'"} = 'ignore';
$replace_line{'VariableShowStmtSHOWvar_name'} = 'SHOW var_name ecpg_into';
$replace_line{'VariableShowStmtSHOWTIMEZONE'} = 'SHOW TIME ZONE ecpg_into';
$replace_line{'VariableShowStmtSHOWTRANSACTIONISOLATIONLEVEL'} = 'SHOW TRANSACTION ISOLATION LEVEL ecpg_into';