Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1gkr-0004kM-It for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jun 2022 04:05:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o1gkp-0002yP-Qy for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Jun 2022 04:05:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1gkp-0002y9-Bd for pgsql-hackers@lists.postgresql.org; Thu, 16 Jun 2022 04:05:11 +0000 Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o1gkk-0001i0-6n for pgsql-hackers@lists.postgresql.org; Thu, 16 Jun 2022 04:05:10 +0000 Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-317741c86fdso778787b3.2 for ; Wed, 15 Jun 2022 21:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xvhFih5CVjYL0wgLPAhCuHwVFXM/P3HXk9P/9UPje5E=; b=fl++9/j/QDvHcu1zy9Wxne77rnNL7iOJj7Kih8fiZgq/ICDmDexn7HZ+6B3kttPM5U o8xfh/vYd9ey+ljotm4Dlfk/v7fGX/UFEYJxYFO48Z03R3hoqh5P/G4PgWgI6rsK3hR0 F2utnVtfPJA5H6fYI/hEPCz9NqblAo4FD8V/m1BbNGnzS/j3eVIWnbirEw6m/ill7A4I rd+d40sKe8tg7uXx429H/dw8rKqmbBuJ6a+GyDK777hvTJe+sHz4dfgKIbc0XCDtRRxm cp7IKd6IFqfnTie59G550LTNU80CErWPaMpZM9hetAo9HMNIszrZW2syWChKFvnCbPeS x/kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xvhFih5CVjYL0wgLPAhCuHwVFXM/P3HXk9P/9UPje5E=; b=FBQFM4fE2gU5MHnFgifA/s1ZsbHkMTdJTbFsAb0vAu9wGOEtut5dWBkj2+VeNcW9a8 BuTwOXVLfbfVLf50Ech+7CCDmNHsIHdRCxykENUK4ogMbqQ//xk5NCmBUJkBA01qGuOo 3aua4UjFu8MftNXMlQOoIhcHUA+PgJyQ0K+PFPj/Sr5QwzjaifyOpVtrkY0+IHCuqp8P GzqDD86a9g0owphltuf3XDZA3C0O9zTjBgVdMqFUh1eYcC8P757d5WmeGHJUtQXXjWSs RXdNMMpsQ2as02wVH4z9PJ3FIwZu/4w8nhJnXvk5PU+/QFmwusgnpjwRCHWl3qUjw3kC eCrA== X-Gm-Message-State: AJIora8J0iA3vsjNGfsSOrAEfVo2OL5EwYmFiKF822njAojvnfCvLbPQ fDlAfUy0xbegCmA8Mh3RERDHrnFXK8HIrTF/vrg= X-Google-Smtp-Source: AGRyM1sOFmf/LvBZzvKBgOTJsYqRbP06IeuYH1b5wJdFIyMaD0Mfy6hcatGcPRCAnWR548Gdli3wZT2lFm5v/JbNoI0= X-Received: by 2002:a81:a143:0:b0:30c:28b5:1d09 with SMTP id y64-20020a81a143000000b0030c28b51d09mr3703678ywg.404.1655352305363; Wed, 15 Jun 2022 21:05:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Thu, 16 Jun 2022 09:34:54 +0530 Message-ID: Subject: Re: Skipping schema changes in publication To: "houzj.fnst@fujitsu.com" Cc: vignesh C , "osumi.takamichi@fujitsu.com" , Peter Smith , Bharath Rupireddy , PostgreSQL Hackers , "hametan@gmail.com" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 14, 2022 at 9:10 AM houzj.fnst@fujitsu.com wrote: > > On Wednesday, June 8, 2022 7:04 PM Amit Kapila wrote: > > > > On Fri, Jun 3, 2022 at 3:37 PM vignesh C wrote: > > > > > > Thanks for the comments, the attached v8 patch has the changes for the > > same. > > > > > > > AFAICS, the summary of this proposal is that we want to support > > exclude of certain objects from publication with two kinds of > > variants. The first variant is to add support to exclude specific > > tables from ALL TABLES PUBLICATION. Without this feature, users need > > to manually add all tables for a database even when she wants to avoid > > only a handful of tables from the database say because they contain > > sensitive information or are not required. We have seen that other > > database like MySQL also provides similar feature [1] (See > > REPLICATE_WILD_IGNORE_TABLE). The proposed syntax for this is as > > follows: > > > > CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT TABLE t1,t2; > > or > > ALTER PUBLICATION pub1 ADD ALL TABLES EXCEPT TABLE t1,t2; > > > > This will allow us to publish all the tables in the current database > > except t1 and t2. Now, I see that pg_dump has a similar option > > provided by switch --exclude-table but that allows tables matching > > patterns which is not the case here. I am not sure if we need a > > similar variant here. > > > > Then users will be allowed to reset the publication by: > > ALTER PUBLICATION pub1 RESET; > > > > This will reset the publication to the default state which includes > > resetting the publication parameters, setting the ALL TABLES flag to > > false, and dropping the relations and schemas that are associated with > > the publication. I don't know if we want to go further with allowing > > to RESET specific parameters and if so which parameters and what would > > its syntax be? > > > > The second variant is to add support to exclude certain columns of a > > table while publishing a particular table. Currently, users need to > > list all required columns' names even if they don't want to hide most > > of the columns in the table (for example Create Publication pub For > > Table t1 (c1, c2)). Consider user doesn't want to publish the 'salary' > > or other sensitive information of executives/employees but would like > > to publish all other columns. I feel in such cases it will be a lot of > > work for the user especially when the table has many columns. I see > > that Oracle has a similar feature [2]. I think without this it will be > > difficult for users to use this feature in some cases. The patch for > > this is not proposed but I would imagine syntax for it to be something > > like "Create Publication pub For Table t1 Except (c3)" and similar > > variants for Alter Publication. > > I think the feature to exclude certain columns of a table would be useful. > > In some production scenarios, we usually do not want to replicate > sensitive fields(column) in the table. Although we already can achieve > this by specify all replicated columns in the list[1], but that seems a > hard work when the table has hundreds of columns. > > [1] > CREATE TABLE test(a int, b int, c int,..., sensitive text); > CRAETE PUBLICATION pub FOR TABLE test(a,b,c,...); > > In addition, it's not easy to maintain the column list like above. Because > we sometimes need to add new fields or delete fields due to business > needs. Every time we add a column(or delete a column in column list), we > need to update the column list. > > If we support Except: > CRAETE PUBLICATION pub FOR TABLE test EXCEPT (sensitive); > > We don't need to update the column list in most cases. > Right, this is a valid point and I think it makes sense for me to support such a feature for column list and also to exclude a particular table(s) from the ALL TABLES publication. Peter E., Euler, and others, do you have any objections to supporting the above-mentioned two cases? -- With Regards, Amit Kapila.