Обсуждение: 9.5.2: "sql" as reserved word?

Поиск
Список
Период
Сортировка

9.5.2: "sql" as reserved word?

От
Marc Mamin
Дата:
Hello,
 
This query is working in 9.4.x, but not in 9.5.2:
 
select 'x' sql;
 
ERROR:  syntax error at or near "sql"
LINE 1: select 'x' sql;
 
 
Is this expected or a known issue?
I could neither find any hint about it in the incompatibility list of the 9.5 release notes,
nor is "sql" listed as reserved keyword.
 
 
 
best regards,
 
Marc Mamin
 

Re: 9.5.2: "sql" as reserved word?

От
Robert Haas
Дата:
On Wed, May 4, 2016 at 9:58 AM, Marc Mamin <M.Mamin@intershop.de> wrote:
> This query is working in 9.4.x, but not in 9.5.2:
>
> select 'x' sql;
>
> ERROR:  syntax error at or near "sql"
> LINE 1: select 'x' sql;
>
> Is this expected or a known issue?
> I could neither find any hint about it in the incompatibility list of the
> 9.5 release notes,
> nor is "sql" listed as reserved keyword.

Sadly, that fails for ANY keyword, not just reserved keywords.
EnterpriseDB has gotten a few customer complaints about this, but it's
not obvious how to fix it.

This commit made SQL a keyword:

commit cac76582053ef8ea07df65fed0757f352da23705
Author: Peter Eisentraut <peter_e@gmx.net>
Date:   Sun Apr 26 10:33:14 2015 -0400
   Add transforms feature
   This provides a mechanism for specifying conversions between SQL data   types and procedural languages.  As
examples,there are transforms   for hstore and ltree for PL/Perl and PL/Python. 
   reviews by Pavel Stěhule and Andres Freund

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: 9.5.2: "sql" as reserved word?

От
Kevin Grittner
Дата:
On Wed, May 4, 2016 at 8:58 AM, Marc Mamin <M.Mamin@intershop.de> wrote:

> select 'x' sql;
>
> ERROR:  syntax error at or near "sql"
> LINE 1: select 'x' sql;

It's likely that you already know this, but for the benefit of
anyone finding the thread who doesn't -- you can avoid this sort of
error by either inserting the optional AS keyword or quoting the
column label:

select 'x' as sql;

or:

select 'x' "sql";

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company