RE: dynamic field names in a function.
| От | Soma Interesting |
|---|---|
| Тема | RE: dynamic field names in a function. |
| Дата | |
| Msg-id | 5.0.2.1.0.20010330105415.02344b10@pop.telus.net обсуждение исходный текст |
| Ответ на | RE: dynamic field names in a function. (Soma Interesting <dfunct@telus.net>) |
| Ответы |
Re: dynamic field names in a function.
Re: dynamic field names in a function. |
| Список | pgsql-general |
Please.
In the following, is there something I can do so that postgres will
evaluate NEW.qty to NEW.name, treating qty as a variable and evaluating it
before evaluating the field reference? At this time it errors on an INSERT
with: "record new has no field qty".
CREATE FUNCTION func_test() RETURNS opaque AS '
DECLARE
qty varchar(5);
BEGIN
qty := ''name'';
NEW.qty := ''target'';
return new;
END;
' LANGUAGE 'plpgsql';
CREATE TRIGGER func_test_trigger BEFORE INSERT
ON test FOR EACH ROW
EXECUTE PROCEDURE func_test ();
В списке pgsql-general по дате отправления: