BUG #4402: Column expansion: date comes wthout a cast - Mailing list pgsql-bugs

From Joachim Unger
Subject BUG #4402: Column expansion: date comes wthout a cast
Date
Msg-id 200809050537.m855bdSv058698@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4402: Column expansion: date comes wthout a cast
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4402
Logged by:          Joachim Unger
Email address:      jo.unger@arcor.de
PostgreSQL version: 8.3
Operating system:   Windwos XP Professional 32 Bit
Description:        Column expansion: date comes wthout a cast
Details:

The column expansion lists date types without a date cast.

Here is an example where I'm using NEW inside a trigger:
[...]
ins_sql := 'INSERT INTO ' ||   quote_ident(new_child_table) || '('
||col_names(new_child_table) || ') VALUES ' || NEW;
RAISE NOTICE 'INSERT: %',ins_sql;
EXECUTE ins_sql;
[...]

Execution of the generated  SQL throws an error:

ERROR:  column "adate" is of type date but expression is of type integer
LINE 1: INSERT INTO table_2008_1(id,adate) VALUES (1,2008-01-30)
HINT:  You will need to rewrite or cast the expression.

That hint describes exactly what is missing:(1,DATE '2008-01-30')

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4401: concurrent updates to a table blocks one update indefinitely
Next
From: "Rainer Glueck"
Date:
Subject: Re: BUG #4398: Backslashes get escaped despite of backslash_quote=off