Re: has_column_privilege behavior (was Re: Assert failed in snprintf.c)

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: has_column_privilege behavior (was Re: Assert failed in snprintf.c)
Date: 2018-10-01 19:54:59
Message-ID: 20181001195459.GI4184@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Stephen Frost <sfrost(at)snowman(dot)net> writes:
> > * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> >> You can't have it both ways. Either you throw an error if the name's
> >> not there, or you don't.
>
> > I'm not following why we couldn't handle a dropped column differently.
>
> Different from what? A name-based lookup isn't going to find a dropped
> column, because its attname has been replaced with
> "........pg.dropped.N........"

My complaint is specifically trying to do something like:

=*# select *
from
pg_class
join pg_attribute on (pg_class.oid = pg_attribute.attrelid)
join pg_namespace on (pg_class.relnamespace = pg_namespace.oid)
where
has_column_privilege(quote_ident(nspname) || '.' || quote_ident(relname),attname,'SELECT');

and getting this:

ERROR: column "........pg.dropped.2........" of relation "t1" does not exist

> > Dropped tables don't hang around in the catalog long after they've been
> > dropped.
>
> If you are talking about the case where a lookup by attnum finds a dropped
> column, that does return null already, cf column_privilege_check().
> But I don't see a way for a name-based lookup to do the same without
> losing all semblance of error detection.

Perhaps it's not worth it then, though I still contend that it's pretty
annoying that we throw an error in that case.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-10-01 20:21:31 settings to control SSL/TLS protocol version
Previous Message Tom Lane 2018-10-01 19:46:34 Re: has_column_privilege behavior (was Re: Assert failed in snprintf.c)