Re: Using SELECT WHERE

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Michal Lijowski <michal(at)cvu(dot)wustl(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using SELECT WHERE
Date: 2004-04-20 18:04:55
Message-ID: 20040420180455.GC11203@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Apr 15, 2004 at 14:03:03 -0500,
Michal Lijowski <michal(at)cvu(dot)wustl(dot)edu> wrote:
> I made a database and I would like to select entries
> which have data not equal to the specified date.
> I have postgresql-7.3.4-11 on Red Hat Fedora Core 1.
>
> Here is the command
>
> RabStudies=> SELECT RabNo, ImplantDate, Comments FROM RabStudiesInfo
> where implantdate <> 0001-01-01;

I believe that you just want to quote the constant. 0001-01-01 is being
treated as 0 and that is somehow being compared to the date. I am not
sure exactly what is going on as integers don't seem to promote to
date or time. EXPLAIN VERBOSE shpws what's happening but I don't know
the oids of operators by heart so it isn't immediately obvious to me
what is happening, but you can use that to check it out yourself if
you want.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2004-04-20 18:06:41 Re: Using SELECT WHERE
Previous Message Tom Lane 2004-04-20 18:00:57 Re: Using SELECT WHERE