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 1hcS0k-0008FP-UV for pgsql-committers@arkaria.postgresql.org; Sun, 16 Jun 2019 10:03: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 1hcS0h-0003F1-Uf for pgsql-committers@arkaria.postgresql.org; Sun, 16 Jun 2019 10:03:39 +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 1hcS0h-0003Eu-9j for pgsql-committers@lists.postgresql.org; Sun, 16 Jun 2019 10:03:39 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hcS0Z-0004Rn-Jd for pgsql-committers@lists.postgresql.org; Sun, 16 Jun 2019 10:03:37 +0000 Received: by mail-wm1-x342.google.com with SMTP id s3so6341116wms.2 for ; Sun, 16 Jun 2019 03:03:31 -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=aMR7YXDxEGfiT6S5P5ipGWdhkdKIIYv9gwnzdUQB9io=; b=dh0gqMtYrcw0eEhIB57KFol6vLXkJwXUUdEdZNCHOANK9U4IDr5frni0cJBtD+WsJ/ sHdaLgvAZNguqLlZ7tSbbZMXY6g1YKoMT5FVeWdHoQoix1IV3uwF2giB66GdO4XA8+f+ bR+6PhRpekCBRiSOPvXqHDQW8CucNNlc/5VY8Z+YQlvJBTwrbdfBW0sW6ge7ttBfFmpL TiodprJvOL78I9ctkTG0yD0u402aqAzGHuVt6VF+opSKnSsbq4hnMLyBYQvsj7tLiS6r V9PBM8HVNuZ2qK6mnpZCaYBDm9TSle6F7vvyVLXMYpuiKMJ27Y403/N+xu4L9n9P1Ely L2IA== 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=aMR7YXDxEGfiT6S5P5ipGWdhkdKIIYv9gwnzdUQB9io=; b=qkdy2TAPyXcxv+5Qr0mPMPvwptmwa6f8/Cy0hvf3/9kzj0lIHfiboov02oDqa6skIO /kFCiwhLgAJXDMcsu9e+x32awGWtYVJ9jTLpPkSmeoENjrG43wy5NBC+zOQaVSO4DyGW yvFGWYIVde9LtNHBZg5i16fahThfzc0kNH0WzK3PaQTbl/Lw7ObQ1W24LBxg7Z4K3bxL gvyE3FGstY2pQn01qUq2BPDPclAGaMFEZ3nncELiq+2Dr/br6q+Hf6fpECj8ogFisaw9 oa8/deJbbP9f2jlFaB4hNo4AV6MbgSx8TD0vTBHr5XZ7S44+gzlBdo8c/JDFcStDdytt FI9Q== X-Gm-Message-State: APjAAAU47BS13wbKPG3DU8ozdTi/+jenPx4NLdYe8JCP1sCqGm5wQft3 8Tl/PYqGVyq7+Gx+eI6EL/STYA== X-Google-Smtp-Source: APXvYqxCNklR9WbAfuPokk0W2qHxGF2veXSkTh93Ghuu3ef8ljp8Disqck78/6DarMg7btOCT3w/xg== X-Received: by 2002:a7b:ca44:: with SMTP id m4mr13485974wml.160.1560679409785; Sun, 16 Jun 2019 03:03:29 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id u18sm5971102wrr.11.2019.06.16.03.03.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 16 Jun 2019 03:03:29 -0700 (PDT) Date: Sun, 16 Jun 2019 12:03:28 +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: <20190616100328.shl2hhuy2pup6ges@development> References: <8833.1560647898@sss.pgh.pa.us> <20156.1560650744@sss.pgh.pa.us> <20190616085651.d2hxuiqlojewed5j@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190616085651.d2hxuiqlojewed5j@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 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. But we're not out of the woods yet, it seems. check-world still fails for me with an error like this: t/011_crash_recovery.pl .............. 1/3 # Failed test 'new xid after restart is greater' # at t/011_crash_recovery.pl line 61. # '486' # > # '486' # Failed test 'xid is aborted after crash' # at t/011_crash_recovery.pl line 65. # got: 'committed' # expected: 'aborted' # Looks like you failed 2 tests of 3. t/011_crash_recovery.pl .............. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests which I find rather strange. I have no idea why splitting a catalog and adding a system view should affect recovery like this. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services