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 1hSjXr-0002vz-P6 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 May 2019 14:45:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSjXq-0000ym-1z for pgsql-hackers@arkaria.postgresql.org; Mon, 20 May 2019 14:45:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSjXp-0000re-J8 for pgsql-hackers@lists.postgresql.org; Mon, 20 May 2019 14:45:41 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSjXV-00045K-2Q for pgsql-hackers@postgresql.org; Mon, 20 May 2019 14:45:39 +0000 Received: by mail-wr1-x441.google.com with SMTP id w13so4178340wru.11 for ; Mon, 20 May 2019 07:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=thQNi/ZWygOPxeqmUlxsT/W/9r1TN+Qj8ssB8WGK5OU=; b=PR8raYm7gLXO4N4q0QTEmPJqKVqRd+le5qLH5zQ9QjcD18ayyXoCcKE2Kg1UIWplVw aAKbh15ggcRBcsnOGXRu+EWWZr0gTvGj4SX1srtUUIw7VWzTwELFSqgdX1bl13IsRS9U CocOfUb/9f4AlLZOdX6ioO6odTapqmYBddyrjJnnuubIAeGXgTQ2aBqNkc1+ghCipqAs dPkC62FXXR6m3ZF4V8KFRBnjn5nKB2KGhpR5kiq3m0c2rpwzyg2HEhjaOxVQOsBIxxQn VmL7/0BsK/K33PCF6e10rLP/1iqgIVamqZKLiU7Hpc1TlVEw2SfyWPj/6s4LZFJ61Z1p SOEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=thQNi/ZWygOPxeqmUlxsT/W/9r1TN+Qj8ssB8WGK5OU=; b=qw9vq/sAbaDoiB7uo99bbDSo/d1fI5d9Qf296rX31TJVKS6JBC+xz7Z31yJaJq0zLR ycoSqs3MjSSalybqFrIbjLvUlHvrr6ErdUTknB0LeFNgRuKf8NTRCtvI0dNvmcAO5c95 qjH5UdmhiJWaETOeHiGrR+hIagjLp15Wt/C/U53EBB2JmzUw5/tPH1HzSrqw+EXB+UiO vJg/Gg92hhHZ3s0K1ge3oLHXACk63C2eXLJIfWq+nJtL1yh0bEEYvJBGcMVF1Df9rCxO QVJRg6T6qoRfHuSriKL4H3GaCLzk5RjE/SrD0Kr7KJxBgDVhA16FKO1E3OIuR5peRg2t AOVw== X-Gm-Message-State: APjAAAVuYvBD7qn/rC7Lrg0au5sTJlNe6EL7D56G53QXiyq74683S6we vzZ250BNaAyOpXVPimKsBb8Cdw== X-Google-Smtp-Source: APXvYqzDNiV2iGE+JgDun2ls8OsK9YtFmRGR7EVnvZnDtZcmLOLZ/B3dFIeldq64JzTPoaxttt5b3g== X-Received: by 2002:a5d:6b50:: with SMTP id x16mr1191502wrw.220.1558363519430; Mon, 20 May 2019 07:45:19 -0700 (PDT) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id y18sm22711491wmd.29.2019.05.20.07.45.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 20 May 2019 07:45:18 -0700 (PDT) Date: Mon, 20 May 2019 16:45:17 +0200 From: Tomas Vondra To: Tom Lane Cc: Dean Rasheed , Stephen Frost , Andres Freund , PostgreSQL Hackers Subject: Re: Multivariate MCV stats can leak data to unprivileged users Message-ID: <20190520144517.kt2m5lk3em7sfkxu@development> References: <20866.1558223060@sss.pgh.pa.us> <20190518234841.GE6197@tamriel.snowman.net> <23229.1558275148@sss.pgh.pa.us> <23772.1558276123@sss.pgh.pa.us> <20190519173845.tgf7ku3vigwgndn5@development> <2509.1558289694@sss.pgh.pa.us> <20190519224459.7dsdnv5gsfmnm4em@development> <23581.1558359144@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <23581.1558359144@sss.pgh.pa.us> User-Agent: NeoMutt/20180716-1444-295967-dirty List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, May 20, 2019 at 09:32:24AM -0400, Tom Lane wrote: >Dean Rasheed writes: >> On Sun, 19 May 2019 at 23:45, Tomas Vondra wrote: >>> Oh, right. It still has the disadvantage that it obfuscates the actual >>> data stored in the pg_stats_ext_data (or whatever would it be called), >>> so e.g. functions would have to do additional checks to make sure it >>> actually is the right statistic type. For example pg_mcv_list_items() >>> could not rely on receiving pg_mcv_list values, as per the signature, >>> but would have to check the value. > >> Yes. In fact, since the user-accessible view would want to expose >> datatypes specific to the stats kinds rather than bytea or cstring >> values, we would need SQL-callable conversion functions for each kind: > >It seems like people are willfully misunderstanding my suggestion. >You'd only need *one* conversion function, which would look at the >embedded ID field and then emit the appropriate text representation. >I don't see a reason why we'd have the separate pg_ndistinct etc. types >any more at all. > That would however require having input functions, which we currently don't have. Otherwise people could not process the statistic values using functions like pg_mcv_list_items(). Which I think is useful. Of course, we could add input functions, but there was a reasoning for not having them (similarly to pg_node_tree). >> Also this model presupposes that all future stats kinds are most >> conveniently represented in a single column, but maybe that won't be >> the case. It's conceivable that a future stats kind would benefit from >> splitting its data across multiple columns. > >Hm, that's possible I suppose, but it seems a little far-fetched. >You could equally well argue that pg_ndistinct etc. should have been >broken down into smaller types, but we didn't. > True. I can't rule out adding such "split" statistic type, but don't think it's very likely. The extended statistic values tend to be complex and easier to represent in a single value. >> Yes, I think it is an EAV model. I think EAV models do have their >> place, but I think that's largely where adding new columns is a common >> operation and involves adding little to no extra code. I don't think >> either of those is true for extended stats. What we've seen over the >> last couple of years is that adding each new stats kind is a large >> undertaking, involving lots of new code. That alone is going to limit >> just how many ever get added, and compared to that effort, adding new >> columns to the catalog is small fry. > >I can't argue with that --- the make-work is just a small part of the >total. But it's still make-work. > >Anyway, it was just a suggestion, and if people don't like it that's >fine. But I don't want it to be rejected on the basis of false >arguments. > Sure. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services