Re: Select question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Chris Ruprecht" <chrup999(at)yahoo(dot)com>
Cc: "psql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Select question
Date: 2001-05-23 16:18:30
Message-ID: 15035.990634710@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Chris Ruprecht" <chrup999(at)yahoo(dot)com> writes:
> phone=# select * from phonelog where cdate > 2001-05-18 order by cdate limit
> 2 ;

Try

select * from phonelog where cdate > '2001-05-18' order by cdate limit 2

I think it's interpreting your query as where cdate > 1978 (result of
integer subexpression) and then doing some weird integer-to-date
conversion. In general, any constant of a non-numeric datatype needs
to be quoted in SQL queries.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-05-23 16:58:36 Re: index/join madness
Previous Message Stephan Szabo 2001-05-23 16:15:15 Re: Select question