BUG #1022: date calculation forces wrong type in function parameter and causes error

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1022: date calculation forces wrong type in function parameter and causes error
Date: 2003-12-19 21:55:13
Message-ID: 20031219215513.1008DCF88AB@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1022
Logged by: Bruce Patin
Email address: bpatin(at)padecs(dot)riss(dot)net
PostgreSQL version: 7.4
Operating system: FreeBSD 4.8-RELEASE
Description: date calculation forces wrong type in function parameter and causes error
Details:

In PostgreSQL 7.4 only, a date type provided as a function parameter gets automatically typecast to 'timestamp without time zone' when calculations are performed on it.

In Pg 7.3 and before, I have successfully used a function with a date parameter such as this simplified version:

CREATE FUNCTION input_date(date) RETURNS INT AS 'SELECT 0;' LANGUAGE 'SQL';

Then, when I calculate a date during execution,
such as:

select input_date('now'::date+'5 years'::interval);

PostgreSQL 7.4 gives error:

ERROR: function input_date(timestamp without time zone) does not exist

The same function works correctly in PostgreSQL 7.3 and before, and it also works even in 7.4 if I do not try to do date calculation, such as:

select input_date('now');

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2003-12-19 22:09:32 Re: Jdbc connection pooling and PG 7.4 consistently fails
Previous Message Bruce Momjian 2003-12-19 21:52:27 Re: [BUGS] pg_service.conf ignores dbname parameter