From: Fernando Hevia <fhevia@ip-tel.com.ar>
To: 'Michael Glaesemann' <grzm@seespotcode.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: subtract a day from the NOW function
Date: Thu, 7 Jun 2007 17:38:47 -0300
Message-ID: <011701c7a943$d9463b30$8f01010a@iptel.com.ar> (raw)
In-Reply-To: <D005E810-0FC2-42EC-98D6-5CA2B9B7B20C@seespotcode.net>
>> B) SELECT * FROM some_table WHERE to_char(some_timestamp,
>> 'YYYYMMDD') >
>> to_char((now() - interval '1 day'), 'YYYYMMDD');
>
>I'd never use to_char to compare dates. The built-in comparison
>operators work just fine.
>
Why not? I'm curious if has anything to do with performance or just style?
Any difference between:
... WHERE to_char(my_date_col:date, 'YYYY.MM.DD') < '2007.06.07'
and
... WHERE my_date_col:date < '2007.06.07'
Is there a 3rd better way to do this comparison?
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: fhevia@ip-tel.com.ar, grzm@seespotcode.net
Subject: Re: subtract a day from the NOW function
In-Reply-To: <011701c7a943$d9463b30$8f01010a@iptel.com.ar>
* 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