Re: SPI_prepare for semi-unknown types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SPI_prepare for semi-unknown types
Дата
Msg-id 3257.993217121@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SPI_prepare for semi-unknown types  (Alex Pilosov <alex@pilosoft.com>)
Список pgsql-hackers
Alex Pilosov <alex@pilosoft.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ed Loehr
Дата:
Сообщение: Re: [GENERAL] Call for alpha testing: planner statistics revisions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql+openssl+uniware7