Re: ALTER TABLE lock strength reduction patch is unsafe Reply-To:

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: ALTER TABLE lock strength reduction patch is unsafe Reply-To:
Дата
Msg-id CA+U5nMJr6vnF-+JweWmvr57qPeBYqTP6XOW4Xg0LYmP=4FyOrg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ALTER TABLE lock strength reduction patch is unsafe Reply-To:  (Noah Misch <noah@leadboat.com>)
Ответы Re: ALTER TABLE lock strength reduction patch is unsafe Reply-To:  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 21 March 2014 20:58, Noah Misch <noah@leadboat.com> wrote:
> On Fri, Mar 21, 2014 at 06:53:27PM +0000, Simon Riggs wrote:
>> On 21 March 2014 17:49, Noah Misch <noah@leadboat.com> wrote:
>>
>> >> >   alter table information_schema.triggers set (security_barrier = true);
>> >>
>> >> I find it hard to justify why we accept such a statement. Surely its a
>> >> bug when the named table turns out to be a view? Presumably ALTER
>> >> SEQUENCE and ALTER <other stuff> has checks for the correct object
>> >> type? OMG.
>> >
>> > We've framed ALTER TABLE's relkind leniency as a historic artifact.  As a move
>> > toward stricter checks, ALTER TABLE refused to operate on foreign tables in
>> > 9.1 and 9.2.  9.3 reversed that course, though.  For better or worse, ALTER
>> > TABLE is nearly a union of the relation ALTER possibilities.  That choice is
>> > well-entrenched.
>>
>> By "well entrenched", I think you mean undocumented, untested, unintentional?
>
> It's deliberate; a -hackers discussion revisits it perhaps once a year.  The
> ALTER VIEW documentation says:
>
>   For historical reasons, ALTER TABLE can be used with views too; but the only
>   variants of ALTER TABLE that are allowed with views are equivalent to the
>   ones shown above.
>
> ALTER INDEX and ALTER SEQUENCE say something similar.
>
>> Do we think anyone *relies* on being able to say the word TABLE when
>> in fact they mean VIEW or SEQUENCE?
>
> pg_dump emits statements that exercise it:
>
>   psql -c 'create view v as select 1 as c; alter view v alter c set default 0;'
>   pg_dump --table v | grep ALTER
>
>> How is that artefact anything but a bug? i.e. is anyone going to stop
>> me fixing it?
>
> It's not the behavior I would choose for a new product, but I can't see
> benefits sufficient to overturn previous decisions to keep it.

Speechless

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: psql blows up on BOM character sequence
Следующее
От: "MauMau"
Дата:
Сообщение: Re: [RFC] What should we do for reliable WAL archiving?