The following bug has been logged on the website: Bug reference: 7899 Logged by: jov Email address: am...@amutu.com PostgreSQL version: 9.1.3 Operating system: CentOS 6 Description:
xxx=# select 2 from (select 1 as end) t; ?column? ---------- 2 (1 row) xxx=# select end from (select 1 as end) t; ERROR: syntax error at or near "end" LINE 1: select end from (select 1 as end) t; ^ xxx=# select version(); version ------------------------------------------------------------------------------------------------------------ -- PostgreSQL 9.1.3 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6), 64-bi t (1 row) I think use key word as alias should get a error message such as $key_word is Key Word,should not be used as identifier bla bla,so for some complex query error user can save a lot of time.