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 1hSMo6-0003Cw-9C for pgsql-hackers@arkaria.postgresql.org; Sun, 19 May 2019 14:28:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSMo5-0007cb-0d for pgsql-hackers@arkaria.postgresql.org; Sun, 19 May 2019 14:28:57 +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 1hSMo4-0007cU-OI for pgsql-hackers@lists.postgresql.org; Sun, 19 May 2019 14:28:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSMny-0001JU-DI for pgsql-hackers@postgresql.org; Sun, 19 May 2019 14:28:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4JESh1p023773; Sun, 19 May 2019 10:28:43 -0400 From: Tom Lane To: Dean Rasheed cc: Stephen Frost , Tomas Vondra , Andres Freund , PostgreSQL Hackers Subject: Re: Multivariate MCV stats can leak data to unprivileged users In-reply-to: <23229.1558275148@sss.pgh.pa.us> References: <20190517202938.lkx6q2u6woiptrsa@alap3.anarazel.de> <21269.1558192388@sss.pgh.pa.us> <4E0E0C14-C476-446A-835F-CC3558709DA9@anarazel.de> <20190518190042.2y33h4toxk4fxv5t@development> <568.1558208711@sss.pgh.pa.us> <20190518232812.qpnjmydlx3uzzsj7@development> <20866.1558223060@sss.pgh.pa.us> <20190518234841.GE6197@tamriel.snowman.net> <23229.1558275148@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 19 May 2019 10:12:28 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23771.1558276123.1@sss.pgh.pa.us> Date: Sun, 19 May 2019 10:28:43 -0400 Message-ID: <23772.1558276123@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > I wonder ... another way we could potentially do this is > create table pg_statistic_ext_data( > stxoid oid, -- OID of owning pg_statistic_ext entry > stxkind char, -- what kind of data > stxdata bytea -- the data, in some format or other > ); > The advantage of this way is that we'd not have to rejigger the > catalog's rowtype every time we think of a new kind of extended > stats. The disadvantage is that manual inspection of the contents > of an entry would become much harder, for lack of any convenient > output function. No, wait, scratch that. We could fold the three existing types pg_ndistinct, pg_dependencies, pg_mcv_list into one new type, say "pg_stats_ext_data", where the actual storage would need to have an ID field (so we'd waste a byte or two duplicating the externally visible stxkind field inside stxdata). The output function for this type is just a switch over the existing code. The big advantage of this way compared to the current approach is that adding a new ext-stats type requires *zero* work with adding new catalog entries. Just add another switch case in pg_stats_ext_data_out() and you're done. regards, tom lane