pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: pg_sequence_last_value() for unlogged sequences on standbys
Date: Tue, 7 May 2024 12:10:33 -0500
Message-ID: <20240507171033.GA2524814@nathanxps13> (raw)
In-Reply-To: <ZjYDvGuHaf_Cx5Pb@paquier.xyz>
References: <20240501005730.GA594666@nathanxps13>
	<1846474.1714525564@sss.pgh.pa.us>
	<20240501011317.GC594666@nathanxps13>
	<20240501020531.GA721953@nathanxps13>
	<ZjG5ia8R_001EvYx@paquier.xyz>
	<20240503204908.GA1737291@nathanxps13>
	<2746846.1714771326@sss.pgh.pa.us>
	<ZjYDvGuHaf_Cx5Pb@paquier.xyz>

On Sat, May 04, 2024 at 06:45:32PM +0900, Michael Paquier wrote:
> On Fri, May 03, 2024 at 05:22:06PM -0400, Tom Lane wrote:
>> Nathan Bossart <nathandbossart@gmail.com> writes:
>>> IIUC this would cause other sessions' temporary sequences to appear in the
>>> view.  Is that desirable?
>> 
>> I assume Michael meant to move the test into the C code, not drop
>> it entirely --- I agree we don't want that.
> 
> Yup.  I meant to remove it from the script and keep only something in
> the C code to avoid the duplication, but you're right that the temp
> sequences would create more noise than now.
> 
>> Moving it has some attraction, but pg_is_other_temp_schema() is also
>> used in a lot of information_schema views, so we couldn't get rid of
>> it without a lot of further hacking.  Not sure we want to relocate
>> that filter responsibility in just one view.
> 
> Okay.

Okay, so are we okay to back-patch something like v1?  Or should we also
return NULL for other sessions' temporary schemas on primaries?  That would
change the condition to something like

	char relpersist = seqrel->rd_rel->relpersistence;

	if (relpersist == RELPERSISTENCE_PERMANENT ||
		(relpersist == RELPERSISTENCE_UNLOGGED && !RecoveryInProgress()) ||
		!RELATION_IS_OTHER_TEMP(seqrel))
	{
		...
	}

I personally think that would be fine to back-patch since pg_sequences
already filters it out anyway.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (19+ messages)  latest in thread

Message-ID: <20240507171033.GA2524814@nathanxps13>
Permalink:  ../20240507171033.GA2524814@nathanxps13/
Also on:    postgresql.org/message-id/20240507171033.GA2524814@nathanxps13

 · 

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: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, michael@paquier.xyz, tgl@sss.pgh.pa.us
  Subject: Re: pg_sequence_last_value() for unlogged sequences on standbys
  In-Reply-To: <20240507171033.GA2524814@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox