Re: Tab completion for view triggers in psql

From: David Fetter <david(at)fetter(dot)org>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tab completion for view triggers in psql
Date: 2010-10-26 02:34:25
Message-ID: 20101026023425.GB1132@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)fetter(dot)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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message kaigai 2010-10-26 02:51:03 Re: security hook on authorization
Previous Message Itagaki Takahiro 2010-10-26 02:10:53 Re: Tab completion for view triggers in psql