pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13502: parser misconstrues table alias
3+ messages / 3 participants
[nested] [flat]

* BUG #13502: parser misconstrues table alias
@ 2015-07-16 02:33  floriparob@gmail.com
  0 siblings, 2 replies; 3+ messages in thread

From: floriparob@gmail.com @ 2015-07-16 02:33 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13502
Logged by:          Robert Stone
Email address:      floriparob@gmail.com
PostgreSQL version: 9.4.4
Operating system:   Debian stretch/sid
Description:        

I aliased a table using the letters TO and the parser pulled an error.
Happens in psql as well as the JDBC driver.
By altering the table alias to TOL overcame the problem.

dinkumerp=# SELECT TO.tol_id, TO.lang_code, SL.lang_name, TO.no_list_text,
TO.table_comment FROM supported_languages SL, tables_opt_list TO  WHERE
TO.lang_code = SL.lang_code AND TO.table_key = 'COA' ORDER BY TO.lang_code;
ERROR:  syntax error at or near "TO"
LINE 1: SELECT TO.tol_id, TO.lang_code, SL.lang_name, TO.no_list_tex...


 PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc-4.9.real
(Debian 4.9.2-20) 4.9.2, 64-bit
(1 row)



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13502: parser misconstrues table alias
@ 2015-07-16 03:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: floriparob@gmail.com
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2015-07-16 03:19 UTC (permalink / raw)
  To: floriparob@gmail.com; +Cc: pgsql-bugs

floriparob@gmail.com writes:
> I aliased a table using the letters TO and the parser pulled an error.

TO is a fully reserved word.  See
http://www.postgresql.org/docs/9.4/static/sql-keywords-appendix.html

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13502: parser misconstrues table alias
@ 2015-07-16 03:23  David G. Johnston <david.g.johnston@gmail.com>
  parent: floriparob@gmail.com
  1 sibling, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2015-07-16 03:23 UTC (permalink / raw)
  To: floriparob@gmail.com <floriparob@gmail.com>; +Cc: pgsql-bugs

On Wednesday, July 15, 2015, <floriparob@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      13502
> Logged by:          Robert Stone
> Email address:      floriparob@gmail.com <javascript:;>
> PostgreSQL version: 9.4.4
> Operating system:   Debian stretch/sid
> Description:
>
> I aliased a table using the letters TO and the parser pulled an error.
> Happens in psql as well as the JDBC driver.
> By altering the table alias to TOL overcame the problem.
>
>
Since TO is fully reserved in the SQL syntax, including PostgreSQL's
implementation, this is not surprising.  If you really want to use those
letters you need to double-quite them.  "TO".column_name.

 http://www.postgresql.org/docs/9.4/interactive/sql-keywords-appendix.html

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2015-07-16 03:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-07-16 02:33 BUG #13502: parser misconstrues table alias floriparob@gmail.com
2015-07-16 03:19 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-07-16 03:23 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox