Re: Pl/Pgsql triger procedure calls with parameters

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Pl/Pgsql triger procedure calls with parameters
Дата
Msg-id 16117.1006818599@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Pl/Pgsql triger procedure calls with parameters  (David A Dickson <davidd@saraswati.wcg.mcgill.ca>)
Список pgsql-general
David A Dickson <davidd@saraswati.wcg.mcgill.ca> writes:
> I am trying to make a call to a function that takes three text parameters
> as input from a trigger. The function is supposed to check if
> SELECT * FROM $3 WHERE new.$1 = $3.$2
> has more than 0 rows.

While this may seem neat and clean, I think you'd be a lot better off
writing multiple trigger functions that have the table and field names
wired into them.  If you insist on parameterizing like this, you will
have to run the queries via EXECUTE in plpgsql, which means you will get
no query plan caching, which is a performance hit you probably do not
want to take in a trigger function.

            regards, tom lane

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

Предыдущее
От: "news.postgresql.org"
Дата:
Сообщение: check constriaint for BLOB
Следующее
От: "Gurupartap Davis"
Дата:
Сообщение: Re: Optimize for insertions?