Re: BUG #1674: CREATE TABLE "name" (with double quotes) and

From: Neil Conway <neilc(at)samurai(dot)com>
To: Herman Bos <hbos(at)osso(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1674: CREATE TABLE "name" (with double quotes) and
Date: 2005-05-19 13:40:10
Message-ID: 428C973A.8060208@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Herman Bos wrote:
> vib=> select * from "bedrag";
> ERROR: relation "bedrag" does not exist

Naturally: there is no such table, regardless of case.

> vib=> select "BEDRAG" from sancties;
> BEDRAG
> --------
> (0 rows)

Not with the SQL you provided:

neilc=# select "BEDRAG" from sancties;
ERROR: relation "sancties" does not exist

> I was wondering if this behavior is correct.

This behavior is intended, although it is true some people find it
confusing. The logic is:

- identifiers specified without double-quotes are folded to lower case
- identifiers specified with double-quotes are not case folded

So your DDL creates a table called SANCTIES since the table name is
double-quoted, whereas "SELECT * FROM SANCTIES" is actually looking for
a table called "sancties". See here for more info:

http://www.postgresql.org/docs/8.0/interactive/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS

-Neil

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Mohan, Ross 2005-05-19 13:45:36 Re: [PORTS] Bug Report with Postgres 7.4 on AIX 5.3
Previous Message Neil Conway 2005-05-19 13:31:41 Re: BUG #1671: Long interval string representation rejected