Re: delta relations in AFTER triggers

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: delta relations in AFTER triggers
Дата
Msg-id CABRT9RC6qN4b3_0Ew85r-Pm2RNpzXVo19Spmu-xhC6yLEMB4zQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: delta relations in AFTER triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: delta relations in AFTER triggers  (Kevin Grittner <kgrittn@ymail.com>)
Список pgsql-hackers
On Mon, Sep 1, 2014 at 9:09 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> OTOH, I agree with Kevin that the things we're talking about are
> lightweight relations not variables.

My worry is that PL/pgSQL and Postgres's SQL dialect is turning into a
Frankenstein monster with many ways to do the same thing, each having
different semantics that require effort to reason about.

Variables and function arguments are non-contriversial, every
experienced coder understands their semantics without thinking twice
-- even if they're not familiar with Postgres.

The concept of "lightweight relations" that pop into existence when a
certain kind of trigger definition is used somewhere in the function
stack, without a CREATE TABLE, without being discoverable in
information_schema etc., I find needs some more justification than
I've seen in this thread. So far I've only heard that it's more
convenient to implement in the current PostgreSQL code base.

I'm sure more questions would pop up in practice, but as Heikki
mentioned: Are such relations also visible to other functions called
by the trigger function?
* If yes, this introduces non-obvious dependencies between functions.
What happens when one trigger with delta relations invokes another
trigger, does the previous one get shadowed or overwritten? What are
the interactions with search_path? Can an unprivileged function
override relation names when calling a SECURITY DEFINER function?

* If not, this further inhibits developers from properly modularizing
their trigger code (this is already a problem due to the current magic
trigger variables).

Even if these questions have reasonable answers, it takes mental
effort to remember the details. Procedure code debugging, especially
triggers, is hard enough due to poor tooling; increasing the cognitive
load should not be done lightly.

You could argue that CREATE TEMP TABLE already has some of these
problems, but it's very rare that people actually need to use that. If
delta relations get built on this new mechanism, avoiding won't be an
option any more.

Regards,
Marti



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: 答复: [HACKERS] why after increase the hash table partitions, TPMC decrease
Следующее
От: Hannu Krosing
Дата:
Сообщение: Re: PL/pgSQL 2