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

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: hubert depesz lubaczewski <depesz(at)depesz(dot)com>, dean(dot)a(dot)rasheed(at)gmail(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: WITH CHECK OPTION support for auto-updatable VIEWs
Date: 2013-07-29 23:43:53
Message-ID: 20130729234353.GB2706@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

depesz,

moved to -hackers..

* hubert depesz lubaczewski (depesz(at)depesz(dot)com) wrote:
> 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).

Interesting.

> 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"?

I think you're half-right, the check should be against 'second', which
should fail because of the '0 = id' check in that view, but we're
reporting the failure as being associated with 'first', which I don't
believe is correct. Dean, thoughts..?

Thanks!

Stephen

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message hubert depesz lubaczewski 2013-07-29 23:45:05 Re: [COMMITTERS] pgsql: WITH CHECK OPTION support for auto-updatable VIEWs
Previous Message hubert depesz lubaczewski 2013-07-29 22:58:30 Re: pgsql: WITH CHECK OPTION support for auto-updatable VIEWs

Browse pgsql-hackers by date

  From Date Subject
Next Message hubert depesz lubaczewski 2013-07-29 23:45:05 Re: [COMMITTERS] pgsql: WITH CHECK OPTION support for auto-updatable VIEWs
Previous Message Tom Lane 2013-07-29 23:25:50 Re: [Pgbuildfarm-members] Bison 3.0 updates