pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guy Fraser <guy@incentre.net>
To: PgSQL - SQL <pgsql-sql@postgresql.org>
Subject: Re: Comparing Dates
Date: Fri, 19 Nov 2004 09:05:03 -0700
Message-ID: <419E19AF.9030405@incentre.net> (raw)
In-Reply-To: <5A709098-39F1-11D9-95C2-000D93AE0944@sitening.com>
References: <419D0DC6.5080504@candoltd.com>
	<FA0F2254-39A6-11D9-95C2-000D93AE0944@sitening.com>
	<87y8gy2xr1.fsf@stark.xeocode.com>
	<5A709098-39F1-11D9-95C2-000D93AE0944@sitening.com>

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.






view thread (14+ messages)

Message-ID: <419E19AF.9030405@incentre.net>
Permalink:  ../419E19AF.9030405@incentre.net/
Also on:    postgresql.org/message-id/419E19AF.9030405@incentre.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: guy@incentre.net
  Subject: Re: Comparing Dates
  In-Reply-To: <419E19AF.9030405@incentre.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox