real - integer type cast in prepared statements

From: Andrei <andyk(at)softwarium(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: real - integer type cast in prepared statements
Date: 2006-03-07 13:58:32
Message-ID: 440D9188.50104@softwarium.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Why when I prepare statement by parsing such query: 'SELECT * FROM
"test" WHERE "ind" < $1 + 1' ("ind" is of type REAL) $1 is interpreted
by backend as INTEGER? Parse completed successfully, but trying to bind
parameter as '20.20' resulted in "ERROR C22P02 Minvalid input syntax for
integer: "20.20" Fnumutils.c L98 Rpg_atoi"? I understand that it's
possible to make query like 'SELECT * FROM "test" WHERE "ind" < $1::real
+ 1', but at the query building time I can't know what type this column is!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2006-03-07 14:09:06 Re: Logging seq scans
Previous Message Florian G. Pflug 2006-03-07 13:14:55 Re: Is the "ACCESS EXCLUSIVE" lock for TRUNCATE really