Re: Allowing DML RULEs that produce Read Only actions during RO xacts

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Allowing DML RULEs that produce Read Only actions during RO xacts
Дата
Msg-id 23554.1260113208@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Allowing DML RULEs that produce Read Only actions during RO xacts  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Allowing DML RULEs that produce Read Only actions during RO xacts  (Simon Riggs <simon@2ndQuadrant.com>)
Re: Allowing DML RULEs that produce Read Only actions during RO xacts  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-hackers
Simon Riggs <simon@2ndQuadrant.com> writes:
> I would like to allow RULEs ON INSERT, ON UPDATE and ON DELETE during
> read only transactions iff they generate only SELECT statements that act
> INSTEAD OF the actual event.

I don't actually believe there is any use case for such a thing.

> This would be a small, but useful additional feature for Hot Standby,
> since it would allow INSERT, UPDATE, DELETE statements to be re-routed,
> for various applications.

How would you "reroute" them without a non-read-only operation happening
somewhere along the line?
> +    /*
> +     * If we're running a SELECT, allow it. This ensures that a
> +     * write rule such as ON INSERT DO SELECT can be executed in
> +     * a read-only session.
> +     */
> +    if (plannedstmt->commandType == CMD_SELECT)
> +        return;

This will fail, very nastily, in writable-CTE cases.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Cancelling idle in transaction state
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Allowing DML RULEs that produce Read Only actions during RO xacts