date - date returns integer?

From: Andrew Hammond <ahammond(at)ca(dot)afilias(dot)info>
To: pgsql-sql(at)postgresql(dot)org
Subject: date - date returns integer?
Date: 2005-03-04 20:59:02
Message-ID: 4228CC16.7020900@ca.afilias.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Should date - date return type integer, not interval?

/* ahammond(at)test:5432/test =# */ SELECT ('2005-03-04'::timestamp -
'2005-01-01'::date)::interval;
~ interval
- ----------
~ 62 days
(1 row)

/* ahammond(at)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(at)ca(dot)afilias(dot)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-----

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2005-03-04 21:54:10 Re: date - date returns integer?
Previous Message Ken Johanson 2005-03-04 15:29:09 Re: definative way to place secs from epoc into timestamp