Re: plpgsql - Insert from a record variable?

Поиск
Список
Период
Сортировка
От Phil Endecott
Тема Re: plpgsql - Insert from a record variable?
Дата
Msg-id 6249353@chezphil.org
обсуждение исходный текст
Ответ на Re: plpgsql - Insert from a record variable?  (basic <basic@mozdev.org>)
Список pgsql-sql
Phil> execute ''column_values :=
Phil>  column_values || quote_literal(r.'' || cr.column_name || '')'';

basic> FOR rec IN EXECUTE
basic>   ''select column_values || quote_literal(r.'' ||
basic>   cr.column_name || '') alias column_values''; LOOP
basic>      column_values := rec.column_values;
basic> END LOOP;

I think your code will try to execute a query like this:

select column_values || quote_literal(r.something) alias column_values

This will fail because column_values and r are both plpgsql variables, and so are not visible to the SQL interpreter.

Any other suggestions?

--Phil.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: subselect prob in view
Следующее
От: "Matthew Nuzum"
Дата:
Сообщение: matching rows differing only by fkey,pkey