Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4OKx-003Qp7-Ta for pgsql-hackers@arkaria.postgresql.org; Tue, 07 May 2024 17:10:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s4OKu-00498y-Sn for pgsql-hackers@arkaria.postgresql.org; Tue, 07 May 2024 17:10:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4OKu-00498p-Jk for pgsql-hackers@lists.postgresql.org; Tue, 07 May 2024 17:10:41 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s4OKr-001u0z-Cm for pgsql-hackers@postgresql.org; Tue, 07 May 2024 17:10:38 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-36c7ee71ebaso15586845ab.2 for ; Tue, 07 May 2024 10:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715101836; x=1715706636; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TgMXzoTAapt0rf8uAvQQCS+l8wZAXvjiVzypwCOmF10=; b=kBHNciN8dNtdmPHE9YQbtN7Y/wcTOWTEkVBzMbtjFgdc2ZgHEjtbRaQqOciRE4IejV ZioC/FBedz1xUWFk23LNJqp8A45fvlPs4g7/tdxOTUAb7ZUTNlJ5TCqqx/WAK1zHQCY0 a/oQiUojQYE4WPwXpvI5c/IZGUcbXF6MEXyebznTY7Z3UU912pneriv62RwdB16W0sWz /2as/pmRsaLJLJpRFGbRqhwn3WE6lR/fIWyWQcMNuTGSLH6wvoTbJgPeJLW0bGEK9jGJ Ne+TiQ4uWR4Qj+iMyvPn6R1/4L/kGkpmhICBZMEZa16kJ2boK9bORVQAGvDFZKHR+XNW NuhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715101836; x=1715706636; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TgMXzoTAapt0rf8uAvQQCS+l8wZAXvjiVzypwCOmF10=; b=mvJ0Kp3EYT0VQdJAYeK7a5pNq1BZy+wCr/pUlLf30j4rGxsp0QkrOVR+4knehFGoVP P+qTSyrqXcGQ4KCbC7PZAbS7UPgi1LSE6RozkHa40M4dhZoVH7I/b77scNXjlaX2YiZT wCfAmU1nN4pyOcDL9nxaYAQcKWhFX6fpfOFCF4QwJqXp0FmCUrrVKilUBqAPGkV8muJT IQTGQPKYtooCgbdtzCTYQzHT1zuAh+JYLqaDbxxeis81hX+418ZCoyVcnpXbMH8D8jg9 G6iQParGbou/JFj/xDakEEbV8FCF7/jGPDlMeHEbJt/4uZkB0YKPFLPUnwbR2UK50mbP ySFw== X-Forwarded-Encrypted: i=1; AJvYcCUhncSIovNrEP+VmSwHu7+9HceyfY8i1qhm7icp+nwvu3UG/yV9NsbNQWhM6NdjyYDj5Jzcaf/LkwB2irphjn7fEdyvajWrP4ygjAI7 X-Gm-Message-State: AOJu0Yw0prktzpazgfWaeoJTGqWH3ywW56+HUc/6vrA1ybc5JIdCscv3 maZ7AD3JsYJViZe0UOUDC/CXhyDX+mU329Jso2KSWb9TJrBDa49eCG3KqA== X-Google-Smtp-Source: AGHT+IGv+Pvy4iOQ/D4nnV7HmbLnDct7Ed/f70UcQDqNZmD/Ki96zyTIkwhEbKRWjOPMSyPSKlD8MA== X-Received: by 2002:a05:6e02:2166:b0:36b:2731:83ce with SMTP id e9e14a558f8ab-36caecd801dmr1273075ab.8.1715101835866; Tue, 07 May 2024 10:10:35 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id cr5-20020a056e023a8500b0036c6c760e41sm2841906ilb.1.2024.05.07.10.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 10:10:35 -0700 (PDT) Date: Tue, 7 May 2024 12:10:33 -0500 From: Nathan Bossart To: Michael Paquier Cc: Tom Lane , pgsql-hackers@postgresql.org Subject: Re: pg_sequence_last_value() for unlogged sequences on standbys Message-ID: <20240507171033.GA2524814@nathanxps13> References: <20240501005730.GA594666@nathanxps13> <1846474.1714525564@sss.pgh.pa.us> <20240501011317.GC594666@nathanxps13> <20240501020531.GA721953@nathanxps13> <20240503204908.GA1737291@nathanxps13> <2746846.1714771326@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 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