Re: pg_sequences bug ?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: "Shinoda, Noriyoshi" <noriyoshi(dot)shinoda(at)hpe(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "snaga(at)uptime(dot)jp" <snaga(at)uptime(dot)jp>
Subject: Re: pg_sequences bug ?
Date: 2017-02-04 12:30:13
Message-ID: CAB7nPqSeg2rU6AkaYZUMN_tz00q6Bx+EQ7X7kbWZoc1kx5VXpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 4, 2017 at 2:50 PM, Shinoda, Noriyoshi
<noriyoshi(dot)shinoda(at)hpe(dot)com> wrote:
> I tried a committed pg_sequences for PostgreSQL 10dev (https://commitfest.postgresql.org/12/771/).
> I found that when multiple users create SEQUENCE, I cannot see the pg_sequences catalog. I think that should work just like pg_tables.
>
> $ psql -U user1
> postgres=> CREATE SEQUENCE seq1 ;
> CREATE SEQUENCE
>
> $ psql -U user2
> postgres=> CREATE SEQUENCE seq2 ;
> CREATE SEQUENCE
> postgres=> SELECT * FROM pg_sequences ;
> ERROR: permission denied for sequence seq1
>
> Apparently it seems that the pg_sequence_last_value function included in the pg_sequences view definition cannot be executed.
> Is this behavior supposed?

That seems user-unfriendly to me.

We could perhaps just use has_sequence_privilege() and return NULL if
the caller of pg_sequences does not have select and usage access to a
given sequence? Please see the patch attached.
--
Michael

Attachment Content-Type Size
pgsequences-read.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2017-02-04 13:06:25 Re: Constraint exclusion failed to prune partition in case of partition expression involves function call
Previous Message Ashutosh Sharma 2017-02-04 12:06:23 Re: pageinspect: Hash index support