public inbox for [email protected]
help / color / mirror / Atom feedFrom: Amit Kapila <[email protected]>
To: Fujii Masao <[email protected]>
Cc: Bharath Rupireddy <[email protected]>
Cc: Tristan Partin <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix publisher-side sequence permission reporting
Date: Thu, 2 Jul 2026 15:25:13 +0530
Message-ID: <CAA4eK1+foYb-vvY2DAq6mg8xn-5q4hY6OiTNPvuHd-ZC5=kwMA@mail.gmail.com> (raw)
In-Reply-To: <CAHGQGwGj0S-eSXfE81qf+xHHy_1LK-XyRr0=DuPC=4PYcB4_aQ@mail.gmail.com>
References: <CAHGQGwGNTaXnBKUV510_P1KwhdbHT+kgZ4zU5njBHy7nCqdhzg@mail.gmail.com>
<[email protected]>
<CAHGQGwE95GLD7RZr2g=zTHKJRafKACmKouhb4TTVH155Hy8zKA@mail.gmail.com>
<[email protected]>
<CAHGQGwFLXCAxKEyvvaTLadHZ8k4DFmjJopnN+Vy-NjtfKoM7dw@mail.gmail.com>
<CAA4eK1JOo0aJRhFHNWpj3hMwaTtNOopY34f1Lh_QD=z=+DrzWQ@mail.gmail.com>
<CAHGQGwEA6PMAE0aMx4MFqj9d+q2Q835gfUyTSJjAkoMwtWB77A@mail.gmail.com>
<CAA4eK1+C+mG6ihu_Cs3KjMw9DJgUneSXy5k0HsXyoE1EeWQ1gQ@mail.gmail.com>
<CAHGQGwHuuffj_js4n2g2M07vpkbun8Aj_4+o4ALK=rQpBfwk7w@mail.gmail.com>
<CALj2ACVAEfVznEv5ubjQJAjDvwwgt0U1qh+s-+hBW0vBapHcEQ@mail.gmail.com>
<CAHGQGwGj0S-eSXfE81qf+xHHy_1LK-XyRr0=DuPC=4PYcB4_aQ@mail.gmail.com>
On Wed, Jul 1, 2026 at 9:38 PM Fujii Masao <[email protected]> wrote:
>
> On Wed, Jun 24, 2026 at 2:40 PM Bharath Rupireddy
> <[email protected]> wrote:
> >
> > Hi,
> >
> > On Tue, Jun 23, 2026 at 5:41 PM Fujii Masao <[email protected]> wrote:
> > >
> > > BTW, isn't the current documentation a bit misleading? It says:
> > >
> > > This function returns a row of NULL values if the sequence does not exist.
> > >
> > > But if the specified object does not exist, pg_get_sequence_data()
> > > raises an error rather than returning a row of NULL values. On the
> > > other hand, it does return a row of NULL values if the specified
> > > object exists but is not a sequence. Is my understanding correct? If
> > > so, how about something like:
> >
> > When the provided relation oid doesn't exist, returns NULL:
> > postgres=# select pg_get_sequence_data(99999999);
> > pg_get_sequence_data
> > ----------------------
> > (,,)
> > (1 row)
>
> Yes. If the specified OID does not exist, the function returns a row of
> NULL values. However, if the object is specified by name and it does
> not exist, an error is raised because the argument has type regclass.
>
> That's why I find the current wording "This function returns a row of
> NULL values if the sequence does not exist." a bit misleading.
>
> How about something like this instead?
>
> This function returns a row of NULL values if the specified relation
> OID does not exist, if it is not a sequence, if the current user lacks
> <literal>SELECT</literal> privilege on the sequence, if the sequence
> is another session's temporary sequence, or if it is an unlogged
> sequence on a standby server.
>
Sounds reasonable. But after this we don't need the next para to say:
"It requires <literal>SELECT</literal> privilege on the sequence.".
See attached.
>
> > > The attached patch adds those HINT messages. It also updates the
> > > related documentation.
> >
> > Nice! This looks more explicit and clarifying. The patch LGTM.
>
> Thanks for the review!
>
> I've updated the patch furthermore. Attached.
>
LGTM.
--
With Regards,
Amit Kapila.
Attachments:
[application/octet-stream] update_doc_1.patch (1.4K, ../CAA4eK1+foYb-vvY2DAq6mg8xn-5q4hY6OiTNPvuHd-ZC5=kwMA@mail.gmail.com/2-update_doc_1.patch)
download | inline diff:
diff --git a/doc/src/sgml/func/func-sequence.sgml b/doc/src/sgml/func/func-sequence.sgml
index de266c36296..9301faa67d2 100644
--- a/doc/src/sgml/func/func-sequence.sgml
+++ b/doc/src/sgml/func/func-sequence.sgml
@@ -163,13 +163,15 @@ SELECT setval('myseq', 42, false); <lineannotation>Next <function>nextval</fu
<structfield>is_called</structfield> indicates whether the sequence has
been used. <structfield>page_lsn</structfield> is the LSN corresponding
to the most recent WAL record that modified this sequence relation.
- This function returns a row of NULL values if the sequence does not
- exist or if the current user lacks privileges on it.
+ This function returns a row of NULL values if the specified relation
+ OID does not exist, if it is not a sequence, if the current user lacks
+ <literal>SELECT</literal> privilege on the sequence, if the sequence
+ is another session's temporary sequence, or if it is an unlogged
+ sequence on a standby server.
</para>
<para>
This function is primarily intended for internal use by pg_dump and by
- logical replication to synchronize sequences. It requires
- <literal>SELECT</literal> privilege on the sequence.
+ logical replication to synchronize sequences.
</para></entry>
</row>
</tbody>
view thread (20+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Fix publisher-side sequence permission reporting
In-Reply-To: <CAA4eK1+foYb-vvY2DAq6mg8xn-5q4hY6OiTNPvuHd-ZC5=kwMA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox