pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feeddate - date returns integer?
3+ messages / 3 participants
[nested] [flat]
* date - date returns integer?
@ 2005-03-04 20:59 Andrew Hammond <ahammond@ca.afilias.info>
2005-03-04 21:54 ` Re: date - date returns integer? Bruno Wolff III <bruno@wolff.to>
2005-03-05 04:36 ` Re: date - date returns integer? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Hammond @ 2005-03-04 20:59 UTC (permalink / raw)
To: pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Should date - date return type integer, not interval?
/* ahammond@test:5432/test =# */ SELECT ('2005-03-04'::timestamp -
'2005-01-01'::date)::interval;
~ interval
- ----------
~ 62 days
(1 row)
/* ahammond@test:5432/test =# */ SELECT ('2005-03-04'::date -
'2005-01-01'::date)::interval;
ERROR: cannot cast type integer to interval
- --
Andrew Hammond 416-673-4138 ahammond@ca.afilias.info
Database Administrator, Afilias Canada Corp.
CB83 2838 4B67 D40F D086 3568 81FC E7E5 27AF 4A9A
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFCKMwVgfzn5SevSpoRAlxAAJ9iPVf2yTNt11JBGc6Hun2s23+/MwCfYRwL
SzElfOrlIskOTAZucUdCeUE=
=jgOp
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: date - date returns integer?
2005-03-04 20:59 date - date returns integer? Andrew Hammond <ahammond@ca.afilias.info>
@ 2005-03-04 21:54 ` Bruno Wolff III <bruno@wolff.to>
1 sibling, 0 replies; 3+ messages in thread
From: Bruno Wolff III @ 2005-03-04 21:54 UTC (permalink / raw)
To: Andrew Hammond <ahammond@ca.afilias.info>; +Cc: pgsql-sql
On Fri, Mar 04, 2005 at 15:59:02 -0500,
Andrew Hammond <ahammond@ca.afilias.info> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Should date - date return type integer, not interval?
Yes. This is in the documentation.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: date - date returns integer?
2005-03-04 20:59 date - date returns integer? Andrew Hammond <ahammond@ca.afilias.info>
@ 2005-03-05 04:36 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2005-03-05 04:36 UTC (permalink / raw)
To: Andrew Hammond <ahammond@ca.afilias.info>; +Cc: pgsql-sql
Andrew Hammond <ahammond@ca.afilias.info> writes:
> Should date - date return type integer, not interval?
If we made it return interval then there would be all sorts of timezone
dependencies introduced (think about DST crossings) ... which is
generally something you don't want to think about when doing date
arithmetic. I think the definitions of these operators are fine.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-03-05 04:36 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-04 20:59 date - date returns integer? Andrew Hammond <ahammond@ca.afilias.info>
2005-03-04 21:54 ` Bruno Wolff III <bruno@wolff.to>
2005-03-05 04:36 ` Tom Lane <tgl@sss.pgh.pa.us>
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