Index: doc/src/sgml/queries.sgml =================================================================== RCS file: /home/saito/CVS_PGWK/PGSQLDEV/doc/src/sgml/queries.sgml,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** doc/src/sgml/queries.sgml 4 Feb 2008 06:35:46 -0000 1.1 --- doc/src/sgml/queries.sgml 4 Feb 2008 17:22:27 -0000 1.2 *************** *** 1047,1052 **** --- 1047,1062 ---- the system will generate a generic name. + + Moreover, AS is omissible. However, a reservation word can't be + included in the name assigned in that case. It is necessary to add and express + AS clearly to include a keyword. The following is the abridged + example. + + SELECT a value, b + c sum FROM ... + + + The naming of output columns here is different from that done in Index: doc/src/sgml/sql.sgml =================================================================== RCS file: /home/saito/CVS_PGWK/PGSQLDEV/doc/src/sgml/sql.sgml,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** doc/src/sgml/sql.sgml 4 Feb 2008 06:35:46 -0000 1.1 --- doc/src/sgml/sql.sgml 4 Feb 2008 17:23:19 -0000 1.2 *************** *** 853,859 **** SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] ! * | expression [ AS output_name ] [, ...] [ INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table ] [ FROM from_item [, ...] ] [ WHERE condition ] --- 853,859 ---- SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] ! * | expression [ [ AS ] output_name ] [, ...] [ INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table ] [ FROM from_item [, ...] ] [ WHERE condition ] Index: doc/src/sgml/ref/select.sgml =================================================================== RCS file: /home/saito/CVS_PGWK/PGSQLDEV/doc/src/sgml/ref/select.sgml,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** doc/src/sgml/ref/select.sgml 4 Feb 2008 06:35:46 -0000 1.1 --- doc/src/sgml/ref/select.sgml 4 Feb 2008 17:23:45 -0000 1.2 *************** *** 21,27 **** SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] ! * | expression [ AS output_name ] [, ...] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY expression [, ...] ] --- 21,27 ---- SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] ! * | expression [ [ AS ] output_name ] [, ...] [ FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY expression [, ...] ] *************** *** 1138,1150 **** The <literal>AS</literal> Key Word ! In the SQL standard, the optional key word AS is just ! noise and can be omitted without affecting the meaning. The ! PostgreSQL parser requires this key ! word when renaming output columns because the type extensibility ! features lead to parsing ambiguities without it. ! AS is optional in FROM ! items, however. --- 1138,1147 ---- The <literal>AS</literal> Key Word ! The optional key word AS is just noise and can be omitted ! without affecting the meaning. However,you have to add AS ! to make a change name into a ! SQL key word. Index: src/backend/parser/gram.y =================================================================== RCS file: /home/saito/CVS_PGWK/PGSQLDEV/src/backend/parser/gram.y,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/backend/parser/gram.y 4 Feb 2008 06:35:46 -0000 1.1 --- src/backend/parser/gram.y 4 Feb 2008 17:24:19 -0000 1.2 *************** *** 8320,8325 **** --- 8320,8333 ---- $$->val = (Node *) $1; $$->location = @1; } + | c_expr IDENT + { + $$ = makeNode(ResTarget); + $$->name = $2; + $$->indirection = NULL; + $$->val = (Node *) $1; + $$->location = @1; + } | a_expr { $$ = makeNode(ResTarget); *************** *** 8714,8719 **** --- 8722,8735 ---- $$->val = (Node *)$1; $$->location = @1; } + | c_expr IDENT + { + $$ = makeNode(ResTarget); + $$->name = $2; + $$->indirection = NIL; + $$->val = (Node *)$1; + $$->location = @1; + } | a_expr { $$ = makeNode(ResTarget);