avoid replace of column with variable in pgsql function

Поиск
Список
Период
Сортировка
От Gerhard Heift
Тема avoid replace of column with variable in pgsql function
Дата
Msg-id 20081116233550.GA19294@toaster.kawo1.rwth-aachen.de
обсуждение исходный текст
Ответы Re: avoid replace of column with variable in pgsql function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello,

I have a function with an out variable in which I have an INSERT
statement with the same name as column. Is it possible to avoid the
replacement?

Its something like this:

CREATE FUNCTION insert_foo(IN bar integer, OUT id integer) AS
$BODY$
BEGIN
  INSERT INTO t1 (id, value) VALUES (bar, bar || '-bar');
  SELECT foo INTO id FROM t2 WHERE value = bar;
END
$BODY$ LANGUAGE 'plpgsql';

In the INSERT statemet the id column is replaced with $2, which is not
what I want. Quoting the colum name does not help. And I dont want to
rename the output variable nor the column of the table.

Is this possible?

Regards,
  Gerhard

Вложения

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

Предыдущее
От: Garry Saddington
Дата:
Сообщение: aggregates and case statements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: avoid replace of column with variable in pgsql function