pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13661: Using word LIMIT
3+ messages / 3 participants
[nested] [flat]

* BUG #13661: Using word LIMIT
@ 2015-10-02 09:32 kmursk@rambler.ru
  2015-10-02 15:48 ` Re: BUG #13661: Using word LIMIT John McKown <john.archie.mckown@gmail.com>
  2015-10-02 16:05 ` Re: BUG #13661: Using word LIMIT David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: kmursk@rambler.ru @ 2015-10-02 09:32 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13661
Logged by:          Danilenko Andrey
Email address:      kmursk@rambler.ru
PostgreSQL version: 9.4.1
Operating system:   Windows
Description:        

Word LIMIT is a clause of SQL-statement and could not be used as a name of
column. But it is possible to create table with this column-name. And for
all that such column-name transforms in upper case. That is bug, because
there shoud not be possibility to use name LIMIT at all with clause CREATE
TABLE. And moreover there shoud not be implicit case-transformation


-- 
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 #13661: Using word LIMIT
  2015-10-02 09:32 BUG #13661: Using word LIMIT kmursk@rambler.ru
@ 2015-10-02 15:48 ` John McKown <john.archie.mckown@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: John McKown @ 2015-10-02 15:48 UTC (permalink / raw)
  To: pgsql-bugs

On Fri, Oct 2, 2015 at 4:32 AM, <kmursk@rambler.ru> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      13661
> Logged by:          Danilenko Andrey
> Email address:      kmursk@rambler.ru
> PostgreSQL version: 9.4.1
> Operating system:   Windows
> Description:
>
> Word LIMIT is a clause of SQL-statement and could not be used as a name of
> column.


​I agree. It is, IMO, "poor practice" to use an SQL keyword as a column
name.​



> But it is possible to create table with this column-name. And for
> all that such column-name transforms in upper case. That is bug, because
> there shoud not be possibility to use name LIMIT at all with clause CREATE
> TABLE. And moreover there shoud not be implicit case-transformation
>
>
​I, personally, do not consider this to be a bug. It is "as designed".

ref:
http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
<quote>
There is a second kind of identifier: the *delimited identifier* or *quoted
identifier*. It is formed by enclosing an arbitrary sequence of characters
in double-quotes ("). A delimited identifier is always an identifier, never
a key word. So "select" could be used to refer to a column or table named
"select", whereas an unquoted select would be taken as a key word and would
therefore provoke a parse error when used where a table or column name is
expected. The example can be written with quoted identifiers like this:
</quote>​


​So, it is possible to write: CREATE TABLE mytable ("select" text); And
then do a SELECT "select" FROM mytable; Just like "select", you are able to
use "LIMIT"

On the same page referenced above:

<quote>
Quoting an identifier also makes it case-sensitive, whereas unquoted names
are always folded to lower case. For example, the identifiers FOO, foo, and
"foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are
different from these three and each other. (The folding of unquoted names
to lower case in PostgreSQL is incompatible with the SQL standard, which
says that unquoted names should be folded to upper case. Thus, foo should
be equivalent to "FOO" not "foo" according to the standard. If you want to
write portable applications you are advised to always quote a particular
name or never quote it.)
</quote>​

​The above might be considered an enhancement request. But the actions of
PostgreSQL, for good or ill, are documented to work as you have experienced.

Of course, this is just a layman's (not a developer's) take on this.​ Oh,
and a transcript from PostgreSQL 9.4.4 on Fedora Linux (RedHat) x86_64:

psql (9.4.4)
Type "help" for help.

dbname=# create table a (limit integer);
ERROR:  syntax error at or near "limit"
LINE 1: create table a (limit integer);
                        ^
dbname=# create table a ("limit" integer, "LIMIT" text);
CREATE TABLE
dbname=# \d a
       Table "public.a"
 Column |  Type   | Modifiers
--------+---------+-----------
 limit  | integer |
 LIMIT  | text    |



-- 

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown

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

* Re: BUG #13661: Using word LIMIT
  2015-10-02 09:32 BUG #13661: Using word LIMIT kmursk@rambler.ru
@ 2015-10-02 16:05 ` David G. Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2015-10-02 16:05 UTC (permalink / raw)
  To: kmursk@rambler.ru; +Cc: pgsql-bugs

On Fri, Oct 2, 2015 at 5:32 AM, <kmursk@rambler.ru> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      13661
> Logged by:          Danilenko Andrey
> Email address:      kmursk@rambler.ru
> PostgreSQL version: 9.4.1
> Operating system:   Windows
> Description:
>
> Word LIMIT is a clause of SQL-statement and could not be used as a name of
> column. But it is possible to create table with this column-name. And for
> all that such column-name transforms in upper case. That is bug, because
> there shoud not be possibility to use name LIMIT at all with clause CREATE
> TABLE. And moreover there shoud not be implicit case-transformation
>

As John indicated naming has quite a few rules and dynamics associated with
it.  If you do not provide exactly what you are typing in or viewing it is
hard to provide a targeted response and we end up quoting you the manual
with a few personal embellishments.

Implicit case transformation to all upper-case is indeed unexpected but
lacking a reproducible example it is going to be attributed to user-error
and not a bug.

David J.
​

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


end of thread, other threads:[~2015-10-02 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-10-02 09:32 BUG #13661: Using word LIMIT kmursk@rambler.ru
2015-10-02 15:48 ` John McKown <john.archie.mckown@gmail.com>
2015-10-02 16:05 ` 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