On Tue, Oct 26, 2010 at 11:10:53AM +0900, Itagaki Takahiro wrote:
> On Tue, Oct 26, 2010 at 10:53 AM, David Fetter <david@fetter.org> wrote:
> >> How about has_table_privilege() to filter candidate relations
> >
> > That's orthogonal to tgtype (snip) Shall I send a new patch with
> > that added?
>
> Do we need to 'add' it?
Possibly. My understanding is that it couldn't really replace it.
> I intended to replace the JOIN with pg_trigger to
> has_table_privilege() (and relkind IN ('r', 'v')) for INSERT,
> UPDATE, and DELETE cases. Query_for_list_of_writeables might still
> require your patch, though.
My understanding is that there are two parts to this:
1. Does the view have the operation (INSERT, UPDATE, or DELETE)
defined on it at all?
2. Can the current role actually perform the operation defined?
If a view has at least one trigger, that view will have corresponding
entries in pg_trigger, and the tgtype entry determines which
operations have been defined, hence that EXISTS() query. This
establishes part 1.
The call to has_table_privilege() establishes part 2.
If I've misunderstood, please let me know :)
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate