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

Re: Comparing Dates

From: Guy Fraser <guy(at)incentre(dot)net>
To: PgSQL - SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Comparing Dates
Date: 2004-11-19 16:05:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
You should use single quotes for all literals.

select '2004-06-08' ;

select 'user' ;

Failing to quote literals will cause unexpected results.

select 2004-06-08 ;

select user ;

"Thomas F.O'Connell" <tfo(at)sitening(dot)com> writes:

> select 2004-06-08;
>   ?column?
> ----------
>       1990
> I'm not exactly sure how the bare string is converted internally, but 
> it's
> clearly not a complete date like you're expecting.

Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

In response to

pgsql-sql by date

Next:From: Michael FuhrDate: 2004-11-19 16:23:09
Subject: Re: transactions in functions, possible bug or what I'm doing
Previous:From: Passynkov, VadimDate: 2004-11-19 15:57:12
Subject: Re: get sequence value of insert command

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