| От | ssylla |
|---|---|
| Тема | Re: Trigger function - variable for schema name [SOLVED] |
| Дата | |
| Msg-id | 1392458613089-5792154.post@n5.nabble.com обсуждение исходный текст |
| Ответ на | Re: Trigger function - variable for schema name [SOLVED] (ssylla <stefansylla@gmx.de>) |
| Список | pgsql-sql |
I even found another way of doing it, since Postgres 9.1 you it is possible
to use "execute format" which seems a little easier to use than the method
with the string concatenation parameters:
CREATE OR REPLACE FUNCTION trigger_function1() RETURNS trigger AS
$$ begin execute format(' select table2.id from %I.table2 where value1=%L
', TG_TABLE_SCHEMA, new.value1) using new into new.id; return new;
end:
$$
language plpgsql;
"%I" replaces the quote_ident method and "%L" the quote_literal method.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/SOLVED-Trigger-function-variable-for-schema-name-tp5788931p5792154.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера