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.96) (envelope-from ) id 1wAgiG-000E7e-0e for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 04:09:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAgiD-003WHJ-1Y for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 04:09:50 +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.96) (envelope-from ) id 1wAgiD-003WHB-05 for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 04:09:50 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wAgiB-000000006Wa-3Nuf for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 04:09:49 +0000 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-c76bde70ec9so173160a12.2 for ; Wed, 08 Apr 2026 21:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775707787; cv=none; d=google.com; s=arc-20240605; b=flQsKJPt0zMfxzv+k87OAjZ/MZ0A8PiMcPbtA/SWsnyP67g3nz/06/A3FhugyflbAh V36aRXErVcCGVrODviPC7UFyXsjO5NtfOwPR/gHZPIZmjuqgfw/R+DN6n7UDscjxwCEF gm5YI93W0yPtEVnN2p/06BY8dGTF+P+2gz9bmmLTrGzqsw8ZV20QpbGcMF4f9sPZNXlx kZpIHwHKPGVVnr2sSuQczQrYzHhgbRhLQeb+EL3hZZaR7lBmFku3eai2GRHx2ol60fXy aT1eRBxJMQg1borrorJNHMBexJwKT3nLEeFlMOqPPp5IECjsE6moz1v2/dL9zHrGIPBa JtMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=p7An1jUEq4p6IIAxgK+MlbDe5/nrLOrGNHNA22fRBU8=; fh=WVKp9S7MoT3EdR/j0B0avbe50hjr75zsHORjm4Fd3r4=; b=jMbnmY/OgDYe0fB2etJeqcJc+iQZm9v7IhJlbL6sdhCgC7J/POEIaMMJLewC+pm3SZ P00h5rT7oerR8BqJlMH6iuXVFvnLH5M8rbB3y7oHQKA6BPSKwiBx+WUKp8POhFcx6yyd KoBxGEI56uSCYj+uBIUjGpOuTvEr88Dp8veDbvtijJ8hHT9ZBH77YhgMxGKCPq38LnEo aNFUI0ROTB+75Pwq9QrX4iMni45+fEDN1kUZjtKKcK+rsewiB674ZjBRoD4JiuWW+WDR iPDVLZ/ZvsKl67uBf59oqcy5prAd9sD1rpKML2LFTZqhzVOYBSHNvFZRi0v6Xwz8GP50 EWiQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775707787; x=1776312587; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=p7An1jUEq4p6IIAxgK+MlbDe5/nrLOrGNHNA22fRBU8=; b=s0iPsJWJTUX6mqOaqnO5ZnmuHMI86Kwx2Yt/yVBRmOTGxPgk/Yz6woiKmkmedLdHRJ 3HteiajjjnRACU193DmrgjcxkEYG1cOwA+HwrV94GiT4dmFNmuKB2UIbYrwIjouBKxUv iZ8PPuL0cbiIgIvdHfHqBRlRnirXWRlAaZucKszyPytT1XPnAzkx7zaQtPxb1zZ1tJCn YzozwVfCavZ35xdZSGyL4oe9TxPtYHEDZvtqbXx74mzINkRoLNZ2+HaB4VJpWaKOY8+9 M+ncdc0go1/FJL14z5GJOItWwmU0Nh/w7hxevwFVcMpuVV2HRhEfirZpttzmbXeTtSA2 qYLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775707787; x=1776312587; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=p7An1jUEq4p6IIAxgK+MlbDe5/nrLOrGNHNA22fRBU8=; b=Tr+Xo8O97py+BSpgPlai6ful7qEfyTX2oDooMLpldjiVwdicYCF1V0jbBRaosQiXs2 bpP6SvS6/7Qi8N2CKuFSED1nyAS8aldcO0yYYH0RxQ1YSsQH22Nh3m6mfneZ1jtE/9B6 7euCGu/1E/jTr+k+Ni1pNfRLfCFb1DhgK1068wvxcDAGLkHqrOFZcUsVmAU5eBZwZNLb I+dYMKzHFtBIG8PYD5qKn0Zqv6lcYK8/v9zckBxQ6wqr6Sr35AZekQ7LqfKZ+AeA7FMX S3iofNu9qfZl3ef2vVNP49LHZaKSpw/2xFDtjGzt2jKC72rXGdc537fxwX0AFzlk1U4U gpbQ== X-Forwarded-Encrypted: i=1; AJvYcCXofZKPBVymOewaPJCKIBhCW4ksUAwS6CN8rKFs46+5HzU9SkUyRJ3h/7Dc8HKBgxw2cIxRrqDY0KI6qsoJ@lists.postgresql.org X-Gm-Message-State: AOJu0YxMhG+BnZRY9BvepaMqcpLGXbBvBqFErgP68nSfFqgInEcwdo6E lLo0vrc+TEoYWF31vKXXz2C+QOwaCTts7Uxe2ESPlkslTsHY3IhQKCKfIMQRJlHDWppiDrusB+M 58KpuNC9CzQQo6B3bF/qJpimF/ScwJ4A= X-Gm-Gg: AeBDietZ5PSd1MR40Iet5RYFR6iRZIbBtTdmAnLGImNP/uXJJqoHKxD4bX1enzdqnTI 25TQD1ixQyFvFip5VMfSL7K6PjQbg7gsKN5tqTirRGdRI8124/q0NfuedQJ8+auG+G3OrnhcF4v yNCunWudBj4z3tiTODj7bVZ9ErBlh1vKdQrCEJnj9iz1TwwqTPS9OMmEqXzg7VXNJW7oSra1ynU cSztGKds56mW6WsT94aDL55YKCSoJuZWru7kAIFPsgbUbVSa9H5hxG4WcSj47DmXkxqBQHI3sqN q8wOnp+isY0Gps7ZnCHRz5wTCu7StlrCpawHZzgUoHKCZTAYxPg= X-Received: by 2002:a17:903:22ca:b0:2b2:6df1:111c with SMTP id d9443c01a7336-2b2c73327camr22023235ad.19.1775707787040; Wed, 08 Apr 2026 21:09:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Thu, 9 Apr 2026 09:39:35 +0530 X-Gm-Features: AQROBzCexd26HPCp9QPVm7DLW1uQMz3YRujek2niTyjvTynB6Yz8s0BOrMBtLA4 Message-ID: Subject: Re: Logical Replication - revisit `is_table_publication` function implementation To: Peter Smith Cc: vignesh C , PostgreSQL Hackers , shveta malik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 8, 2026 at 11:58=E2=80=AFAM Peter Smith = wrote: > > On Wed, Apr 8, 2026 at 4:04=E2=80=AFPM Peter Smith wrote: > > > > On Wed, Apr 8, 2026 at 3:25=E2=80=AFPM shveta malik wrote: > > > > > > On Wed, Apr 8, 2026 at 10:24=E2=80=AFAM Peter Smith wrote: > > > > > > > > On Wed, Apr 8, 2026 at 1:45=E2=80=AFPM vignesh C wrote: > > > > > > ... > > > > > And also why just check for puballtables why not to check for pub= allsequences > > > > > > > > I think function is_schema_publication() is unrelated to 'puballseq= uences'. > > > > > > > > e.g. all the following will still need to check > > > > pg_publication_namespace, regardless of the 'puballsequences' value= . > > > > > > > > ex1. CREATE PUBLICATION ... FOR ALL SEQUENCES; > > > > ex2. CREATE PUBLICATION ... FOR ALL SEQUENCES, FOR TABLES IN SCHEMA= s1; > > > > ex3. CREATE PUBLICATION ... FOR TABLES IN SCHEMA s1; > > > > > > > > > > IIUC, we don't support mix of ALL SEQUENCES and TABLES IN SCHEMA s1. > > > So I could not understand your point, why FOR ALL SEQ still need to > > > check pg_publication_namespace? > > > > > > > Oh! You are right. > > > > (Sorry, Vignesh, I did not recognise that combination as unsupported). > > > > I'll post a patch update to handle it. > > > > PSA patch v2. > > Same as before, but now also doing a quick return false from both > functions if `puballsequences` is true. > Okay. I was trying to determine where this optimization would be beneficial= . In cases, where we attempt to add tables or schemas to an ALL TABLES or ALL SEQUENCES publication, the operation will error out in CheckAlterPublication() before is_table_publication() or is_schema_publication() are even called. And in cases where we are trying to add table or schema to a non ALL-TABLEs/SEQ pub, and we end up invoking these functions, we still need to traverse pg_pub_rel. The only scenario (as I understand it) that benefits from this change is when we try to add EXCEPT to an ALL TABLES publication. In that case, both of the concerned functions would not need to access pg_pub_rel if the publication is already an ALL TABLES publication. So this optimization helps in a positive (non-erroneous) case. In cases where we need to throw an error (for example, adding EXCEPT to a FOR TABLE publication), these checks would not provide any benefit as we still need to traverse pg_pub_rel to see if it has any valid tables or it is an emty publication (empty one is fine). But since the optimization improves a valid, non-erroneous scenario, IMO, it is good to include it. Let's see what others have to say on this. thanks Shveta