On 29 September 2010 19:41, Peter Bex <Peter.Bex@xxxxxxxxx> wrote: > On Wed, Sep 29, 2010 at 07:33:53PM +0100, Thom Brown wrote: >> Okay, I understand what's happening. But does the planner need to >> understand the type of literals in the select list if it's not used >> anywhere else? > > Fields sent back to the client also carry their type with them. > There's no "unknown" type (and it wouldn't be very useful in any > case, because how would you go about displaying an unknown type?) There is an unknown type... test=# create table stuff (id serial); NOTICE: CREATE TABLE will create implicit sequence "stuff_id_seq" for serial column "stuff.id" CREATE TABLE test=# insert into stuff select c from generate_series(1,100) x(c); INSERT 0 100 test=# PREPARE meow(unknown) AS SELECT * from stuff where id < $1; PREPARE test=# execute meow(3); id ---- 1 2 (2 rows) test=# PREPARE bark(unknown) AS SELECT * from stuff where id < $1; PREPARE test=# execute bark('3'::unknown); id ---- 1 2 (2 rows) The docs specifically make mention of it in the case of PREPARE. -- Thom Brown Twitter: @darkixion IRC (freenode): dark_ixion Registered Linux user: #516935 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general