pg_sequences bug ?

Started by Shinoda, Noriyoshi (PN Japan FSIP)over 9 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t35967
psql -h localhost -U postgres

Built from patchset v2 (message #2), September 20, 2026 at 01:15 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t35967_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t35967_2 && git checkout t35967_2

Patchset v2 (message #2) is on t35967_2

Jump to latest
#1Shinoda, Noriyoshi (PN Japan FSIP)
noriyoshi.shinoda@hpe.com

Hi hackers,

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?

Snapshot:
https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.gz 2017-02-04 00:29:04
Operating System:
Red Hat Enterprise Linux 7 Update 2 (x86-64)

Regards.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Michael Paquier
michael@paquier.xyz
In reply to: Shinoda, Noriyoshi (PN Japan FSIP) (#1)
Re: pg_sequences bug ?

On Sat, Feb 4, 2017 at 2:50 PM, Shinoda, Noriyoshi
<noriyoshi.shinoda@hpe.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

Attachments:

t35967_2
pgsequences-read.patchtext/x-patch; charset=US-ASCII; name=pgsequences-read.patchDownload+9-2
#3Peter Eisentraut
peter_e@gmx.net
In reply to: Michael Paquier (#2)
Re: pg_sequences bug ?

On 2/4/17 7:30 AM, Michael Paquier wrote:

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.

Committed with documentation updates. Thanks.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers