Re: pgsql: WITH CHECK OPTION support for auto-updatable VIEWs

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: pgsql: WITH CHECK OPTION support for auto-updatable VIEWs
Дата
Msg-id 20130729225830.GA31029@depesz.com
обсуждение исходный текст
Ответ на pgsql: WITH CHECK OPTION support for auto-updatable VIEWs  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-committers
On Thu, Jul 18, 2013 at 09:24:02PM +0000, Stephen Frost wrote:
> WITH CHECK OPTION support for auto-updatable VIEWs
>
> For simple views which are automatically updatable, this patch allows
> the user to specify what level of checking should be done on records
> being inserted or updated.  For 'LOCAL CHECK', new tuples are validated
> against the conditionals of the view they are being inserted into, while
> for 'CASCADED CHECK' the new tuples are validated against the
> conditionals for all views involved (from the top down).
>
> This option is part of the SQL specification.
>
> Dean Rasheed, reviewed by Pavel Stehule
>
> Branch
> ------
> master

What am I missing here:

create table some_data (id int4 primary key, payload text);
create view first as select * from some_data where 0 = id % 2 with local check option;
create view second as select * from first where 0 = id with local check option;

insert into second (id, payload) values (15, '15 is divisible by 3, but not by 2');
ERROR:  new row violates WITH CHECK OPTION for view "first"
DETAIL:  Failing row contains (15, 15 is divisible by 3, but not by 2).

If I read it correctly, insert to "second" with id = 15 should work,
because the where on "second" matches, and local check shouldn't be
checking on "first"?

Best regards,

depesz



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

Предыдущее
От: Greg Stark
Дата:
Сообщение: pgsql: Sync ECPG with WITH ORDINALITY changes
Следующее
От: Bruce Momjian
Дата:
Сообщение: pgsql: pg_upgrade: clarify C comment about Windows thread struct pointe