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 1tadMl-003fmn-OV for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jan 2025 16:14:08 +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 1tadMj-001b2s-Pc for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jan 2025 16:14:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tadMj-001b2k-AU for pgsql-hackers@lists.postgresql.org; Wed, 22 Jan 2025 16:14:05 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tadMf-000vxB-39 for pgsql-hackers@lists.postgresql.org; Wed, 22 Jan 2025 16:14:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1737562441; bh=nfnm0Kl3NNWB4S+QvWwSe3eihFgU65ayjol9xs06ojE=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=Ol8PiCQEXdy/mD8kDmjnq2JhBj+n4iFFeKJfIrzZGKq6Pc89gIGbYmuRl7mw9iFJW tHH4b6vCqtDMIDQ2E2dNog+GI1b8zjeaCaKWabCKKcNegpgLFGqCjmiHBSkEOxyS/2 4qgTOZCyjFUIvETvi5f3z77rys71q4muaOY5A2O7VBnq5opuB3kUMDYZrVI1owtgC2 PTfXERstD4cK6SwGKudGXQ9zt1YJ/GyTsZD5AdJx8/1Uhx/BWc3Ak+hcXMNkK3EOPn DIWMa2R6KHKmvBCNwKUDvd219IF9UANAzqw+N+SHUX61nwiU4c4FwliwnzLt1YOXXo HiG8nYn43St4Q== Received: from [192.168.129.193] (unknown [91.193.178.201]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: s.tatarintsev@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id 4055A60DF4; Wed, 22 Jan 2025 19:14:00 +0300 (MSK) Message-ID: <547d522b-2457-4dcc-a7cc-322f0e953be5@postgrespro.ru> Date: Wed, 22 Jan 2025 19:13:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: create subscription with (origin = none, copy_data = on) To: Shlok Kyal , "Zhijie Hou (Fujitsu)" Cc: vignesh C , "pgsql-hackers@lists.postgresql.org" , Amit Kapila References: <5eda6a9c-63cf-404d-8a49-8dcb116a29f3@postgrespro.ru> Content-Language: en-US From: Sergey Tatarintsev In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/01/22 10:19:00 #27099507 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 22.01.2025 18:41, Shlok Kyal пишет: > On Wed, 22 Jan 2025 at 09:00, Zhijie Hou (Fujitsu) > wrote: >> On Tuesday, January 21, 2025 1:31 AM vignesh C wrote: >> >> Hi, >> >>> On Mon, 20 Jan 2025 at 17:31, Amit Kapila wrote: >>>> On Sat, Jan 18, 2025 at 10:31 AM vignesh C wrote: >>>>> Attached patch has the fix for this issue which includes the >>>>> partition tables also for the publication now and throws a warning >>>>> appropriately. >>>>> >>>> The corresponding query (see "To find which tables might potentially >>>> include non-local origins .." on [1]) on the create_subscription doc >>>> page. >>>> BTW, the proposed fix is not backpatcheable as it changes the catalog >>>> which requires catversion bump. However, as this is a WARNING case, if >>>> we can't find a fix that can't be backpatched, we can fix it in >>>> HEAD-only. >>> I could not find a way to fix the back version without changing the catalog >>> version. >>> >>> The attached v3 version has the changes for the same. >> Thanks for the patch. >> >> I agree that covering the partitioned table case when checking the non-local >> origin data on publisher is an improvement. But I think adding or extending the >> SQL functions may not be the appropriate way to fix because the new functions >> cannot be used in older PG version and is also not backpatchable. >> >> I am thinking it would be better to use the existing pg_partition_ancestors() >> and pg_partition_tree() to verify the same, which can be used in all supported >> PG versions and is also backpatchable. >> >> And here is another version which fixed the issue like that. I have not added >> tests for it, but I think it's doable to write the something like the testcases >> provided by Sergey. This patch does not fix the foreign tabel as that seems to >> be a separate issue which can be fixed independtly. >> >> Hi Sergey, if you have the time, could you please verify whether this patch >> resolves the partition issue you reported? I've confirmed that it passes the >> partitioned tests in the scripts, but I would appreciate your confirmation for >> the same. >> > Hi Hou-san, > > I have created a patch to add a test for the patch. > > v5-0001 : same as v4-0001 > v5-0002: adds the testcase > > Thanks and Regards, > Shlok Kyal Hi! Sorry, I can't do it right now, but I think we need add testcase where ancestor of published table have different origin. Also we still don't care about foreign partitions  (as I wrote earlier we should raise an ERROR for such publications). This checking must be done at publication creation in check_publication_add_relation(), but I not sure about publication for all tables/for tables in schema because one foreign table will block publication creation Thoughts?