Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gQ0nw-0007s9-S2 for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Nov 2018 02:02:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gQ0nt-0000p8-LJ for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Nov 2018 02:02:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gQ0nt-0000mr-DY for pgsql-hackers@lists.postgresql.org; Fri, 23 Nov 2018 02:02:45 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gQ0nk-0007eC-KS for pgsql-hackers@postgresql.org; Fri, 23 Nov 2018 02:02:42 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 57B4B5F79C; Thu, 22 Nov 2018 21:02:35 -0500 (EST) Date: Thu, 22 Nov 2018 21:02:35 -0500 From: Stephen Frost To: Euler Taveira Cc: Craig Ringer , pgsql-hackers Subject: Re: row filtering for logical replication Message-ID: <20181123020235.GG3415@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="X51x5yMCUZddmyY1" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --X51x5yMCUZddmyY1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, * Euler Taveira (euler@timbira.com.br) wrote: > 2018-02-28 21:54 GMT-03:00 Craig Ringer : > > Good idea. I haven't read this yet, but one thing to make sure you've > > handled is limiting the clause to referencing only the current tuple and the > > catalogs. user-catalog tables are OK, too, anything that is > > RelationIsAccessibleInLogicalDecoding(). > > > > This means only immutable functions may be invoked, since a stable or > > volatile function might attempt to access a table. And views must be > > prohibited or recursively checked. (We have tree walkers that would help > > with this). > > > > It might be worth looking at the current logic for CHECK expressions, since > > the requirements are similar. In my opinion you could safely not bother with > > allowing access to user catalog tables in the filter expressions and limit > > them strictly to immutable functions and the tuple its self. > > IIRC implementation is similar to RLS expressions. I'll check all of > these rules. Given the similarity to RLS and the nearby discussion about allowing non-superusers to create subscriptions, and probably publications later, I wonder if we shouldn't be somehow associating this with RLS policies instead of having the publication filtering be entirely independent.. Thanks! Stephen --X51x5yMCUZddmyY1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJb91+7AAoJEO1sijiDR2RVVsMP/3jtdXYLI23Bgrs+qrUe2QGW YPnZ/+JMcxkqyg0MydNoE2cJOQQAPSnV3485uaHFh8+3e6mZxp7aDSiYL85Oh/zy iTfumKNFBUWnhaycD6Gjo6cUJEVfeXPnPY7xsb32PAltSDgKkRxJHc/zh8awwx1V CHKnd0KHqrDtDCPqdPzLrIdMPl8ad6e0LFwfLsybKmpmPP0hAqGdwbPkaV2yQ/pm c1FH5XZ/yWxMSCE5d4BKhETDf3gO/sghRClH0sXjeBQHcQGp7MeEbZnpd8ftYSw1 9lX/Grp9PuI4E1/NaR013/vhRu3gI9gAZebneH/iwexLLJyBwys8pi3+aGe7iv1a oSVAi9s7e3lhSOfzGOoRUq4sB31LiVuLBkLu8mP63pJvKYSHQmAh/4kwwy9J55R3 3trbqE0gy7gfQla6A7Hw/mRlD4LrizLKbe/WDoE/bYyV8GASQT9jeHsv95btQSsu 0jsqu13rOcJRVp112DMDNm5d4+Tb+cxhgtW8Fhka8ww5EJm5wsqyDftA8JDoUmOr BbwA4MEM5rlqVCV7jg4Atjyvv2L6u/C0q8P1bk6DzmI2gih4UI3//Tf7m0TCnp64 P17ig4NACqbfKSQEcd2HcyTG/1mAk+7PI7cv+YU6KNzvqSPKsUTrEEFJ2DFcbpXY v0R1PU0LS/+2Dlt+AvX9 =lIQh -----END PGP SIGNATURE----- --X51x5yMCUZddmyY1--