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 1n33jV-0006e6-If for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Dec 2021 22:17: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 1n33iy-0004jT-VG for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Dec 2021 22:16:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n33iy-0004jJ-IM for pgsql-hackers@lists.postgresql.org; Thu, 30 Dec 2021 22:16:40 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n33iv-0004ix-PB for pgsql-hackers@postgresql.org; Thu, 30 Dec 2021 22:16:40 +0000 Received: by mail-io1-xd30.google.com with SMTP id y18so22755685iob.8 for ; Thu, 30 Dec 2021 14:16:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VaHhMpxlz4rol03pQp6nNrWoS/Yu/zd28XCC2z8tpfo=; b=MdarswYn26w9fglA5VBwo2l836zwI8/UgL35qc1tW6VT4gWsT35Zkb0cg+3GlYdN1s yIbf27fi6d4qB80wh2It+NDaZ+jy6Jkxzc3VMRlXujHVuaZaD/RasOmWfcRhBXW4Zrrv wPKcDwGsfhcbU0OsoHYkZQ4+0/+Hu9a4gdlJJnydY05uR/cMPkAESlrN+K9P3fe4DE3n FZpyTfPFMhSxhAHz2skLs+RsjW28l78LjiYZaaQALj0pYOQg69rcKzkCbPIZMbYYVkE5 QH/mOYOWwpHU5YJK5OEBNnUgQU9stw0Q9fFBUaqL6dvf4FTFP5Pr0FOyh7A6Zb8vlLDk AITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VaHhMpxlz4rol03pQp6nNrWoS/Yu/zd28XCC2z8tpfo=; b=BZfPKb44JqoiNIkncpLtFwkLhKq2fyG7f3DBT6L+yfY7AL5jbfapRLCEb9S+jiiRil nhtGUffRZENnYXAoNzErXf7SgAPtrFiB2Dp8ftiGsRMa8s4lnKPYCJP84P4SrKZ4p8rl u27jRrGNBpaks7ViSNi5xy984/ESvwB5kMJhmfJv0ZJEs1YOTGjLf6zGXlIBRy56aL9R BjZ9rY7NPiGRksny7o07W7amPekqcRv1tpUsNBHKK/ZGSJDRxQrkkRLDohi0T8gQ3+xN DVfa9vj0eY5WpWk0H3MN5VTxD46Qme30iTkOmXOSIxyuBBZYShvxaq+wZ1s3qB1k/7qs xdEA== X-Gm-Message-State: AOAM533jh8h3W//FV5AcBz2+M+gaK+gPdw9pMs31n7EfsYjxd3OIPbhH iFO+SX/sM/MQgrwXpIVeGv33Ww== X-Google-Smtp-Source: ABdhPJx8iPgIrgUWvvztTbt4rfOezeZ9W8JIfs/Z2j8RNGvH+pWo8AZy94QsEgiJ1iLpxfu1AOmckA== X-Received: by 2002:a02:b707:: with SMTP id g7mr15771720jam.86.1640902595704; Thu, 30 Dec 2021 14:16:35 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id g11sm15494464ild.52.2021.12.30.14.16.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Dec 2021 14:16:35 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 766D6800A3C; Thu, 30 Dec 2021 16:16:34 -0600 (CST) Date: Thu, 30 Dec 2021 16:16:34 -0600 From: Justin Pryzby To: Alvaro Herrera Cc: Tomas Vondra , Amit Kapila , Peter Eisentraut , "houzj.fnst@fujitsu.com" , Rahila Syed , Peter Smith , pgsql-hackers@postgresql.org Subject: Re: Column Filtering in Logical Replication Message-ID: <20211230221634.GT24477@telsasoft.com> References: <202112300015.sh7xv36pgao2@alvherre.pgsql> <202112302021.ca7ihogysgh3@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202112302021.ca7ihogysgh3@alvherre.pgsql> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > + bool am_partition = false; >... > Assert(!isnull); > lrel->relkind = DatumGetChar(slot_getattr(slot, 3, &isnull)); > Assert(!isnull); > + am_partition = DatumGetChar(slot_getattr(slot, 4, &isnull)); I think this needs to be GetBool. You should Assert(!isnull) like the others. Also, I think it doesn't need to be initialized to "false". > + /* > + * Even if the user listed all columns in the column list, we cannot > + * allow a column list to be specified when REPLICA IDENTITY is FULL; > + * that would cause problems if a new column is added later, because > + * that could would have to be included (because of being part of the could would is wrong > + /* > + * Translate list of columns to attnums. We prohibit system attributes and > + * make sure there are no duplicate columns. > + * > + */ extraneous line > +/* > + * Gets a list of OIDs of all column-partial publications of the given > + * relation, that is, those that specify a column list. I would call this a "partial-column" publication. > + errmsg("cannot set REPLICA IDENTITY FULL when column-partial publications exist")); > + * Check column-partial publications. All publications have to include all same > + /* > + * Store the column names only if they are contained in column filter period(.) > + * LogicalRepRelation will only contain attributes corresponding to those > + * specficied in column filters. specified > --- a/src/include/catalog/pg_publication_rel.h > +++ b/src/include/catalog/pg_publication_rel.h > @@ -31,6 +31,9 @@ CATALOG(pg_publication_rel,6106,PublicationRelRelationId) > Oid oid; /* oid */ > Oid prpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */ > Oid prrelid BKI_LOOKUP(pg_class); /* Oid of the relation */ > +#ifdef CATALOG_VARLEN > + int2vector prattrs; /* Variable length field starts here */ > +#endif The language in the pre-existing comments is better: /* variable-length fields start here */ > @@ -791,12 +875,13 @@ fetch_remote_table_info(char *nspname, char *relname, > > ExecClearTuple(slot); > } > + > ExecDropSingleTupleTableSlot(slot); > + walrcv_clear_result(res); > + pfree(cmd.data); > > lrel->natts = natt; > > - walrcv_clear_result(res); > - pfree(cmd.data); > } The blank line after "lrel->natts = natt;" should be removed.