Re: SPI_prepare for semi-unknown types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alex Pilosov <alex(at)pilosoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SPI_prepare for semi-unknown types
Date: 2001-06-22 13:38:41
Message-ID: 3257.993217121@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alex Pilosov <alex(at)pilosoft(dot)com> writes:
> Example, having a statement like 'select count(*) from foo where
> fieldname=$1' where I know that $1 is a stringish type and it _should_ be
> convertable using xxx_in (CString-to-datum conversion functions), however,
> I do not know the precise type (could be name or varchar or text).

Declare the parameter as text, and then coerce what you are given to
text before you execute the statement. You don't get any free
adaptation to new datatypes in an already-completed plan.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-06-22 14:32:04 Re: psql+openssl+uniware7
Previous Message Karel Zak 2001-06-22 12:01:27 Re: nocreatetable for 7.1.2 [patch]