- Allowed some C keywords to be used as SQL column names.
authorMichael Meskes
Sun, 15 Feb 2004 15:38:20 +0000 (15:38 +0000)
committerMichael Meskes
Sun, 15 Feb 2004 15:38:20 +0000 (15:38 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/preproc/preproc.y

index 23dd86b2b87aeefd790b31cf6b4d6381c4f8609d..929012ca8b8634e28f725b307071f7a929ce9fae 100644 (file)
@@ -1739,5 +1739,6 @@ Mon Jan 26 21:57:14 CET 2004
 Sun Feb 15 14:44:14 CET 2004
 
    - Added missing braces to array parsing.
+   - Allowed some C keywords to be used as SQL column names.
    - Set ecpg version to 3.1.1.
 
index 55ac0829c90e2f793c7915208eac76c8f43a2c04..0c1a9cc984c049018334d8456f1086945153fa81 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.272 2004/02/15 13:48:54 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.273 2004/02/15 15:38:20 meskes Exp $ */
 
 /* Copyright comment */
 %{
@@ -528,7 +528,7 @@ add_additional_variables(char *name, bool insert)
 %type     user_name opt_user char_variable ora_user ident opt_reference
 %type     var_type_declarations quoted_ident_stringvar ECPGKeywords_rest
 %type     db_prefix server opt_options opt_connection_name c_list
-%type     ECPGSetConnection ECPGTypedef c_args ECPGKeywords 
+%type     ECPGSetConnection ECPGTypedef c_args ECPGKeywords ECPGCKeywords
 %type     enum_type civar civarind ECPGCursorStmt ECPGDeallocate
 %type     ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
 %type     struct_union_type s_struct_union vt_declarations execute_rest
@@ -5747,6 +5747,7 @@ ColId:    ident                       { $$ = $1; }
        | unreserved_keyword            { $$ = $1; }
        | col_name_keyword          { $$ = $1; }
        | ECPGKeywords              { $$ = $1; }
+       | ECPGCKeywords             { $$ = $1; }
        | CHAR_P                { $$ = make_str("char"); }
        ;
 
@@ -5756,6 +5757,7 @@ type_name:    ident                   { $$ = $1; }
        | unreserved_keyword            { $$ = $1; }
        | ECPGKeywords              { $$ = $1; }
        | ECPGTypeName              { $$ = $1; }
+       | ECPGCKeywords             { $$ = $1; }
        ;
 
 /* Function identifier --- names that can be function names.
@@ -5764,6 +5766,7 @@ function_name:    ident                   { $$ = $1; }
        | unreserved_keyword            { $$ = $1; }
        | func_name_keyword         { $$ = $1; }
        | ECPGKeywords              { $$ = $1; }
+       | ECPGCKeywords             { $$ = $1; }
        ;
 
 /* Column label --- allowed labels in "AS" clauses.
@@ -5775,6 +5778,7 @@ ColLabel:  ECPGColLabel               { $$ = $1; }
        | INPUT_P           { $$ = make_str("input"); }
        | INT_P             { $$ = make_str("int"); }
        | UNION             { $$ = make_str("union"); }
+       | ECPGCKeywords         { $$ = $1; }
        ;
 
 ECPGColLabelCommon:  ident                              { $$ = $1; }
@@ -5789,6 +5793,14 @@ ECPGColLabel:  ECPGColLabelCommon            { $$ = $1; }
        | ECPGKeywords_rest         { $$ = $1; }
        ;
 
+ECPGCKeywords: S_AUTO          { $$ = make_str("auto"); }
+       | S_CONST           { $$ = make_str("const"); }
+       | S_EXTERN          { $$ = make_str("extern"); }
+       | S_REGISTER            { $$ = make_str("register"); }
+       | S_STATIC          { $$ = make_str("static"); }
+       | S_TYPEDEF         { $$ = make_str("typedef"); }
+       ;
+       
 /*
  * Keyword classification lists.  Generally, every keyword present in
  * the Postgres grammar should appear in exactly one of these lists.