| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Tristan Partin <tristan(at)partin(dot)io>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Fix publisher-side sequence permission reporting |
| Date: | 2026-07-02 09:55:13 |
| Message-ID: | CAA4eK1+foYb-vvY2DAq6mg8xn-5q4hY6OiTNPvuHd-ZC5=kwMA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Jul 1, 2026 at 9:38 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Wed, Jun 24, 2026 at 2:40 PM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> >
> > Hi,
> >
> > On Tue, Jun 23, 2026 at 5:41 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> 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.
| Attachment | Content-Type | Size |
|---|---|---|
| update_doc_1.patch | application/octet-stream | 1.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-07-02 10:03:38 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | Chao Li | 2026-07-02 09:34:28 | Re: Escape CR/LF in invalid database, role, and tablespace name errors |