Re: Valid role name (PostgreSQL 9.0.4) - Mailing list pgsql-novice

From Josh Kupershmidt
Subject Re: Valid role name (PostgreSQL 9.0.4)
Date
Msg-id BANLkTin6+r06N+FMeaE3=ujEu8o-hXRpHA@mail.gmail.com
Whole thread Raw
In response to Re: Valid role name (PostgreSQL 9.0.4)  (Grzegorz Szpetkowski <gszpetkowski@gmail.com>)
List pgsql-novice
On Fri, Apr 8, 2011 at 10:11 AM, Grzegorz Szpetkowski
<gszpetkowski@gmail.com> wrote:
> Since USER is reserved PostgreSQL keywords should I generally avoid
> such names ?

I would avoid creating user names and other identifiers (names of
functions, schemas, databases, tables, etc.) which collide with
reserved words.

> I found that I can even create (distinct) "USER" role:
>
> createuser -SdR USER
> psql -c "\du"
>                       List of roles
>  Role name |            Attributes             | Member of
> -----------+-----------------------------------+-----------
>  USER      | Create DB                         | {}
>  postgres  | Superuser, Create role, Create DB | {}
>  user      | Create DB                         | {}

Yup; from:
<http://www.postgresql.org/docs/9.0/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS>
  "Quoting an identifier also makes it case-sensitive, whereas
unquoted names are always folded to lower case."

Josh

pgsql-novice by date:

Previous
From: Grzegorz Szpetkowski
Date:
Subject: Re: Valid role name (PostgreSQL 9.0.4)
Next
From: Francisco Leovey
Date:
Subject: Need SQL of create TABLE including INDEX and SEQUENCE