Re: computed values in plpgsql

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: computed values in plpgsql
Дата
Msg-id b42b73150909281058x134e5a68ke6e4d66fb6179998@mail.gmail.com
обсуждение исходный текст
Ответ на Re: computed values in plpgsql  (Reid Thompson <reid.thompson@ateb.com>)
Список pgsql-general
On Mon, Sep 28, 2009 at 1:29 PM, Reid Thompson <reid.thompson@ateb.com> wrote:
> On Mon, 2009-09-28 at 12:42 -0400, Merlin Moncure wrote:
>
>> the best way to do this is very version dependent.  the basic trick is
>> to use text cast to pass a composite type into the query sting.
>>
>> one way:
>> execute 'insert into foo_something select (' || new::text || '::foo).*';
>>
>> you can try:
>> execute 'insert into foo_something select ($1::foo).*' using new::text;
>>
>> merlin
>
> thanks,  we're using version 8.3.7.

'execute using' is 8.4 feature.  so you have to use the string
concatenation approach.  let me fix the errors:

execute 'insert into foo_something select (''' || new::text || '''::foo).*';

:-)

merlin

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

Предыдущее
От: Reid Thompson
Дата:
Сообщение: Re: computed values in plpgsql
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Functions returning multiple rowsets