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 1hcTD9-00029M-JH for pgsql-committers@arkaria.postgresql.org; Sun, 16 Jun 2019 11:20:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hcTD8-0000KM-0u for pgsql-committers@arkaria.postgresql.org; Sun, 16 Jun 2019 11:20:34 +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 1hcTD7-0000C1-Gt for pgsql-committers@lists.postgresql.org; Sun, 16 Jun 2019 11:20:33 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcTD4-00052h-7c for pgsql-committers@lists.postgresql.org; Sun, 16 Jun 2019 11:20:32 +0000 Received: by mail-wr1-x444.google.com with SMTP id c2so6860903wrm.8 for ; Sun, 16 Jun 2019 04:20:29 -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=HhK00GkJwz0IEXOVzHeSi4UJ7S4GybrB2roxBhwZHjk=; b=eLVvsKjjE/SWMYMdBCFo48fElSOYJGzsPh8EVayL8zVp6lduUsAxdW4gdzhdbfF4ex 3NS5YWLWIdRULfqD28l0Emc1JBbCb/feo9NaM7l3saEfH+Fri7zzb9oFXmt6GiMC/MbW cFy2KRnZjoeOcAO3vw9b28d1DUGvrre1mMxxegRA4R1YWa1eYPVPofoNAszFeKs3JqaP nBHt1MQ4jmrp7cshDU0vP4KX0UA8/y8eK2dH4zVhw5VmUfeVKgYG7hfjL+ivliCfvV9F +s1M0r+OMmzW+QDtFj9SBI9Yd4LxBeeNGSRVnqPATGZCsL4cYGSOT067qrfDXLAcwwGg wXfw== 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=HhK00GkJwz0IEXOVzHeSi4UJ7S4GybrB2roxBhwZHjk=; b=uVRzY5Y3HpawvvcIlqimhzhkbyCu7HLogA4x3q5SG46ENaM1uaBdzioFIlACNy1oQS 07hVxHQ4OFBATUKrtAUr38aAJk3520WiBe132RoM8BCy+mJ3OjMJHqtdDarjPSW1hHaR JToqv054zDY5nODkm53JxgWcuR7ux11/UNzxteypYSlkcEaRUNQKjaWAz1KxRXj8Mz76 olfcnu2g7kFWMHKUt4p7rrd7WKk0exZI265Rph7wawR8yJucn4mTVMC/tE1IKClDqVIW 9v1OxJj4ef/dcp0GpXNhgbHnPnrOqsCPoIbZaIIB1pSKKrJuyF3qKK9HM4kVcF0cFTGA lblg== X-Gm-Message-State: APjAAAXK8zItHVMIeC2rFeYxEZFKniaQFlk8E46D7dQYScyi75SdLuFL diIu1xyVxZpEWueXcQ+EzTmFjw== X-Google-Smtp-Source: APXvYqyHkua8jdxlEuwWMhx054v/1b2kG1gcdMg2KyXVr2dPuUaX/EynbaRDqqSC7BkkK00XzEwptg== X-Received: by 2002:adf:e34e:: with SMTP id n14mr52524659wrj.169.1560684028186; Sun, 16 Jun 2019 04:20:28 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id 74sm10121168wma.7.2019.06.16.04.20.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 04:20:22 -0700 (PDT) Date: Sun, 16 Jun 2019 13:20:21 +0200 From: Tomas Vondra To: Dean Rasheed Cc: Tom Lane , Tomas Vondra , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Rework the pg_statistic_ext catalog Message-ID: <20190616112021.2mncnuj26sbsbnzx@development> References: <8833.1560647898@sss.pgh.pa.us> <20156.1560650744@sss.pgh.pa.us> <20190616085651.d2hxuiqlojewed5j@development> <20190616100328.shl2hhuy2pup6ges@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190616100328.shl2hhuy2pup6ges@development> User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Jun 16, 2019 at 12:03:28PM +0200, Tomas Vondra wrote: >On Sun, Jun 16, 2019 at 10:56:51AM +0200, Tomas Vondra wrote: >>On Sun, Jun 16, 2019 at 07:18:58AM +0100, Dean Rasheed wrote: >>>On Sun, 16 Jun 2019, 03:05 Tom Lane, wrote: >>> >>>>I wrote: >>>>>Tomas Vondra writes: >>>>>>Rework the pg_statistic_ext catalog >>>> >>>>>So ... not one of the buildfarm members that are running TAP tests >>>>>likes this. ... >>>>>I think probably what's happening is that pg_dump is still trying to dump >>>>>directly from the catalog, when what it needs to do now is dump from the >>>>>view, in case it's not running as superuser. >>>> >>>>I experimented with extracting the required data from the view, and >>>>there are at least two show-stopper problems: >>>> >>>>* The view doesn't expose pg_statistic_ext.oid, which pg_dump has to have >>>>for dependency tracking purposes. I think we could just add it though. >>>>Now that OIDs are ordinary columns it won't even look very odd. >>>> >>>>* Rather than just not exposing the critical data for stats you don't >>>>have privilege to read, the view doesn't expose anything at all. >>>>I do not think that's acceptable; it creates a significant hazard of >>>>data loss during pg_dump, for no very good reason. What we should >>>>be doing, IMO, is still showing all the rows but filling the data-value >>>>columns with nulls in rows where the caller can't access the underlying >>>>data. >>>> >>>> >>> >>>Hang on. Isn't the real problem that we should be revoking public access >>>from pg_statistic_ext_data, not pg_statistic_ext? Normal users should still >>>be able to see the stats definitions in the catalog table, but not the >>>stats data, so I think pg_dump wouldn't need changing. >>> >> >>Yeah, that's pretty much why we split the catalog - to allow pg_dump to >>read the definitions, without exposing the stats too. I'll look into >>this and push a fix to unbreak the buildfarm (sorry about that). >> > >OK, the bug here seems to be pretty silly - the GRANT in system_views >does this: > >GRANT SELECT (oid, stxrelid, stxname, stxnamespace, stxowner, stxkeys, stxkind) > ON pg_statistic_ext TO public; > >but pg_dump also uses tableoid column. After adding it to the GRANT I >can run pg_dump using regular user just fine. I'll push this fix >shortly. > OK, it seems the buildfarm is getting green again. I'm not sure why I'm seeing the failure in 011_crash_recovery.pl, while the buildfarm does not. Perhaps my environment is borked in some way? Not sure. Anyway, I'm wondering if we need the REVOKE/GRANT on pg_statistic_ext at all, and if we do if we should just remove the list of columns, and grant SELECT on all. All the sensitive columns were moved to another catalog, after all. That also reminds me the patch should have revoked access to the new _data catalog. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services