Re: Sequence Access Methods, round two

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Sequence Access Methods, round two
Date: 2024-03-13 06:00:37
Message-ID: aa383e86-0dae-4533-b1a4-6a34a3c247a2@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12.03.24 00:44, Michael Paquier wrote:
> Anyway, there is one piece of this patch set that I think has a lot of
> value outside of the discussion with access methods, which is to
> redesign pg_sequence_last_value so as it returns a (last_value,
> is_called) tuple rather than a (last_value). This has the benefit of
> switching pg_dump to use this function rather than relying on a scan
> of the heap table used by a sequence to retrieve the state of a
> sequence dumped. This is the main diff:
> - appendPQExpBuffer(query,
> - "SELECT last_value, is_called FROM %s",
> - fmtQualifiedDumpable(tbinfo));
> + /*
> + * In versions 17 and up, pg_sequence_last_value() has been switched to
> + * return a tuple with last_value and is_called.
> + */
> + if (fout->remoteVersion >= 170000)
> + appendPQExpBuffer(query,
> + "SELECT last_value, is_called "
> + "FROM pg_sequence_last_value('%s')",
> + fmtQualifiedDumpable(tbinfo));
> + else
> + appendPQExpBuffer(query,
> + "SELECT last_value, is_called FROM %s",
> + fmtQualifiedDumpable(tbinfo));
>
> Are there any objections to that? pg_sequence_last_value() is
> something that we've only been relying on internally for the catalog
> pg_sequences.

I don't understand what the overall benefit of this change is supposed
to be.

If this route were to be pursued, it should be a different function
name. We shouldn't change the signature of an existing function.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo NAGATA 2024-03-13 06:09:18 Re: pg_column_toast_chunk_id: a function to get a chunk ID of a TOASTed value
Previous Message Andrey M. Borodin 2024-03-13 05:56:06 Re: Transaction timeout