pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
date + interval year - why is the return type convered to a timestamp? 2+ messages / 2 participants [nested] [flat]
* date + interval year - why is the return type convered to a timestamp? @ 2009-10-22 21:04 the6campbells <the6campbells@gmail.com> 0 siblings, 1 reply; 2+ messages in thread From: the6campbells @ 2009-10-22 21:04 UTC (permalink / raw) To: pgsql-sql Why is Postgres returning a timestamp instead of the expected date data type for the first expression (the second returns a date)? In other words, is this a known bug or is it design intent. The manuals did not seem to appear to say this is intentional behaviour but is not SQL standard. select date '2001-03-30' - interval '1' year, date '2001-03-30' - integer '365' from tversion ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: date + interval year - why is the return type convered to a timestamp? @ 2009-10-22 23:15 Tom Lane <tgl@sss.pgh.pa.us> parent: the6campbells <the6campbells@gmail.com> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2009-10-22 23:15 UTC (permalink / raw) To: the6campbells <the6campbells@gmail.com>; +Cc: pgsql-sql the6campbells <the6campbells@gmail.com> writes: > Why is Postgres returning a timestamp instead of the expected date data type > for the first expression (the second returns a date)? > select date '2001-03-30' - interval '1' year, date '2001-03-30' - integer > '365' from tversion Would you expect a date for date '2001-03-30' - interval '1 hour' ? They are type-wise the same case; we don't have different types for different lengths of interval. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2009-10-22 23:15 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2009-10-22 21:04 date + interval year - why is the return type convered to a timestamp? the6campbells <the6campbells@gmail.com> 2009-10-22 23:15 ` 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