Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group