Re: Column does not exists? - Mailing list pgsql-general

From Leonardo M. Ramé
Subject Re: Column does not exists?
Date
Msg-id 55144239.1020000@griensu.com
Whole thread Raw
In response to Re: Column does not exists?  (Francisco Olarte <folarte@peoplecall.com>)
Responses Re: Column does not exists?  (Francisco Olarte <folarte@peoplecall.com>)
List pgsql-general
El 26/03/15 a las 14:23, Francisco Olarte escibió:
> Hi Leonardo:
>
> On Thu, Mar 26, 2015 at 6:12 PM, "Leonardo M. Ramé" <l.rame@griensu.com> wrote:
>> DELETE From sessions WHERE SESSIONTIMESTAMP < '2010-01-01 10:02:02'
>> ERROR:  column "sessiontimestamp" does not exist
>> LINE 1: DELETE From sessions WHERE SESSIONTIMESTAMP < '2010-01-01 10...
> ...
>> DELETE From sessions WHERE "SESSIONTIMESTAMP" < '2010-01-01 10:02:02'
>>
>> It DOES work.
>>
>> Why the db doesn't recognize the name of the table without quotes?.
>
> Unquoted identifiers for several things, column names amongst them,
> are treated by case folding in SQL. Many DBs do it to uppercase,
> postgres does it to lower case ( as hinted by the column name being
> printed in lowercase ). So if you QUOTE an UPPERCASE name you must
> quote it always.
>
> As a rule of thumb, I'll recommend quoting your identifiers always or
> never, quoting it in some statements ( create ) and not others ( 1st
> delete ) will normally surprise you on unpleasant ways.
>
> Francisco Olarte.
>

Aha, the problem, then, was caused by the Create statement. This table
was copied from a MySql dump where all columns were named "column".


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Column does not exists?
Next
From: Marc Mamin
Date:
Subject: Re: :Posgres - performance problem