aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-02-15 22:17:06 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-02-15 22:17:06 +0000
commite67867b26cf052e166b39c6457ee04861cb81ead (patch)
treedafa8a47410c9f23565fe3df13368d06640bb060 /src/interfaces
parentcc80f0a340cdeba7716c5e128346481b82cc6949 (diff)
downloadpostgresql-e67867b26cf052e166b39c6457ee04861cb81ead.tar.gz
postgresql-e67867b26cf052e166b39c6457ee04861cb81ead.zip
Allow AS to be omitted when specifying an output column name in SELECT
(or RETURNING), but only when the output name is not any SQL keyword. This seems as close as we can get to the standard's syntax without a great deal of thrashing. Original patch by Hiroshi Saito, amended by me.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 6dd32b930b3..43efc431dba 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.360 2008/02/14 14:54:48 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.361 2008/02/15 22:17:06 tgl Exp $ */
/* Copyright comment */
%{
@@ -521,8 +521,9 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
%nonassoc OVERLAPS
%nonassoc BETWEEN
%nonassoc IN_P
-%left POSTFIXOP /* dummy for postfix Op rules */
-%left Op OPERATOR /* multi-character ops and user-defined operators */
+%left POSTFIXOP /* dummy for postfix Op rules */
+%nonassoc IDENT /* to support target_el without AS */
+%left Op OPERATOR /* multi-character ops and user-defined operators */
%nonassoc NOTNULL
%nonassoc ISNULL
%nonassoc IS NULL_P TRUE_P FALSE_P UNKNOWN
@@ -4695,9 +4696,10 @@ target_list: target_list ',' target_el
{ $$ = $1; }
;
-/* AS is not optional because shift/red conflict with unary ops */
target_el: a_expr AS ColLabel
{ $$ = cat_str(3, $1, make_str("as"), $3); }
+ | a_expr IDENT
+ { $$ = cat_str(3, $1, make_str("as"), $2); }
| a_expr
{ $$ = $1; }
| '*'