Re: Comparing Dates - Mailing list pgsql-sql

From Guy Fraser
Subject Re: Comparing Dates
Date
Msg-id 419E19AF.9030405@incentre.net
Whole thread Raw
In response to Re: Comparing Dates  (Thomas F.O'Connell <tfo@sitening.com>)
List pgsql-sql
You should use single quotes for all literals.

Examples:
select '2004-06-08' ; ?column?
------------2004-06-08

select 'user' ;?column?
----------user

Failing to quote literals will cause unexpected results.

Examples:
select 2004-06-08 ;?column?
----------    1990

select user ;current_user
--------------guy


"Thomas F.O'Connell" <tfo@sitening.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.





pgsql-sql by date:

Previous
From: "Passynkov, Vadim"
Date:
Subject: Re: get sequence value of insert command
Next
From: Michael Fuhr
Date:
Subject: Re: transactions in functions, possible bug or what I'm doing