Re: Patch to support SEMI and ANTI join removal

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Patch to support SEMI and ANTI join removal
Дата
Msg-id 54240C51.8040304@vmware.com
обсуждение исходный текст
Ответ на Re: Patch to support SEMI and ANTI join removal  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Patch to support SEMI and ANTI join removal  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers
On 09/16/2014 01:20 PM, David Rowley wrote:
> +    /*
> +     * We mustn't allow any joins to be removed if there are any pending
> +     * foreign key triggers in the queue. This could happen if we are planning
> +     * a query that has been executed from within a volatile function and the
> +     * query which called this volatile function has made some changes to a
> +     * table referenced by a foreign key. The reason for this is that any
> +     * updates to a table which is referenced by a foreign key constraint will
> +     * only have the referencing tables updated after the command is complete,
> +     * so there is a window of time where records may violate the foreign key
> +     * constraint.
> +     *
> +     * Currently this code is quite naive, as we won't even attempt to remove
> +     * the join if there are *any* pending foreign key triggers, on any
> +     * relation. It may be worthwhile to improve this to check if there's any
> +     * pending triggers for the referencing relation in the join.
> +     */
> +    if (!AfterTriggerQueueIsEmpty())
> +        return false;

Hmm. This code runs when the query is planned. There is no guarantee 
that there won't be after triggers pending when the query is later 
*executed*.

- Heikki




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

Предыдущее
От: Gregory Smith
Дата:
Сообщение: Re: proposal: rounding up time value less than its unit.
Следующее
От: Robert Haas
Дата:
Сообщение: Re: add modulo (%) operator to pgbench