Skip to content

Commit 2a54525

Browse files
author
Michael Meskes
committed
- Allowed some C keywords to be used as SQL column names.
1 parent a05977e commit 2a54525

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,5 +1739,6 @@ Mon Jan 26 21:57:14 CET 2004
17391739
Sun Feb 15 14:44:14 CET 2004
17401740

17411741
- Added missing braces to array parsing.
1742+
- Allowed some C keywords to be used as SQL column names.
17421743
- Set ecpg version to 3.1.1.
17431744

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.272 2004/02/15 13:48:54 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.273 2004/02/15 15:38:20 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -528,7 +528,7 @@ add_additional_variables(char *name, bool insert)
528528
%type <str> user_name opt_user char_variable ora_user ident opt_reference
529529
%type <str> var_type_declarations quoted_ident_stringvar ECPGKeywords_rest
530530
%type <str> db_prefix server opt_options opt_connection_name c_list
531-
%type <str> ECPGSetConnection ECPGTypedef c_args ECPGKeywords
531+
%type <str> ECPGSetConnection ECPGTypedef c_args ECPGKeywords ECPGCKeywords
532532
%type <str> enum_type civar civarind ECPGCursorStmt ECPGDeallocate
533533
%type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition
534534
%type <str> struct_union_type s_struct_union vt_declarations execute_rest
@@ -5747,6 +5747,7 @@ ColId: ident { $$ = $1; }
57475747
| unreserved_keyword { $$ = $1; }
57485748
| col_name_keyword { $$ = $1; }
57495749
| ECPGKeywords { $$ = $1; }
5750+
| ECPGCKeywords { $$ = $1; }
57505751
| CHAR_P { $$ = make_str("char"); }
57515752
;
57525753

@@ -5756,6 +5757,7 @@ type_name: ident { $$ = $1; }
57565757
| unreserved_keyword { $$ = $1; }
57575758
| ECPGKeywords { $$ = $1; }
57585759
| ECPGTypeName { $$ = $1; }
5760+
| ECPGCKeywords { $$ = $1; }
57595761
;
57605762

57615763
/* Function identifier --- names that can be function names.
@@ -5764,6 +5766,7 @@ function_name: ident { $$ = $1; }
57645766
| unreserved_keyword { $$ = $1; }
57655767
| func_name_keyword { $$ = $1; }
57665768
| ECPGKeywords { $$ = $1; }
5769+
| ECPGCKeywords { $$ = $1; }
57675770
;
57685771

57695772
/* Column label --- allowed labels in "AS" clauses.
@@ -5775,6 +5778,7 @@ ColLabel: ECPGColLabel { $$ = $1; }
57755778
| INPUT_P { $$ = make_str("input"); }
57765779
| INT_P { $$ = make_str("int"); }
57775780
| UNION { $$ = make_str("union"); }
5781+
| ECPGCKeywords { $$ = $1; }
57785782
;
57795783

57805784
ECPGColLabelCommon: ident { $$ = $1; }
@@ -5789,6 +5793,14 @@ ECPGColLabel: ECPGColLabelCommon { $$ = $1; }
57895793
| ECPGKeywords_rest { $$ = $1; }
57905794
;
57915795

5796+
ECPGCKeywords: S_AUTO { $$ = make_str("auto"); }
5797+
| S_CONST { $$ = make_str("const"); }
5798+
| S_EXTERN { $$ = make_str("extern"); }
5799+
| S_REGISTER { $$ = make_str("register"); }
5800+
| S_STATIC { $$ = make_str("static"); }
5801+
| S_TYPEDEF { $$ = make_str("typedef"); }
5802+
;
5803+
57925804
/*
57935805
* Keyword classification lists. Generally, every keyword present in
57945806
* the Postgres grammar should appear in exactly one of these lists.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy