Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGBvu-0000AB-Ob for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Aug 2021 03:08:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mGBvt-0002dI-Ml for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Aug 2021 03:08:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mGBvt-0002bt-BP for pgsql-hackers@lists.postgresql.org; Wed, 18 Aug 2021 03:08:01 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mGBvq-0001LX-30 for pgsql-hackers@postgresql.org; Wed, 18 Aug 2021 03:08:00 +0000 Received: by mail-io1-xd2c.google.com with SMTP id a13so850496iol.5 for ; Tue, 17 Aug 2021 20:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-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=xSj9Jufz6We07jL0uXYpClt6tdSnVRb0BfNwcSYrmpQ=; b=v/LEFzBaXiT03S3aAYtnHLoMDHvI1ynrFxeTylNYyx72UyKqcFWjaE/T2Ayd9uaV56 T4K4R0zjntykAWf6MoDCkwz8GLojkaX6d6fJhb4GMu7ejxquU6Bp4NWLD+451CaKMf/E 3/i0T1LfzFED5Y1nitjE0qSM7YaxjVI0fT5FJeejiikbPIRsAPShQGuWwu56XW9zeMaf sB2I4z4mlm0W6VayYzMQwUP0gcM//Wm0YZO6srC+R4G3fdr8cVMGKlNcQA5qI0YFXKNL mY1OHxcH3qIka2tbTWwxgXR+JlLhcmGL2+DtpVSjLEm21bxSyDy0tG9CIp1fsJMjG8dI WtfA== 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=xSj9Jufz6We07jL0uXYpClt6tdSnVRb0BfNwcSYrmpQ=; b=MYPF383LPJeNrKJsSvqQc7S4ObmA4PagpR08VOfJYzVrJs8oMlU+Qz8zOWkC4VTPk3 sE8iTYA6iNYfHRGR/3gujtFrUxjiNa0g5uql/EhXsR3lFZYdkyzlsdKcsO0gQAaPVgF5 68khnk4tAZRi3dWG9OuGCOVOITRlYY5TMTvf8kUA1ZnQaXL23Vupye6oz/3Qez/CFOvy VrrJVJkjD6MlJQaOXXMK5+k43gU5Rw6vT/ZDUAUApeKYGsjZz3EEudpiyp0b6/nAeM7C /NmJqKeMoCGps8jZZo8+sovEcXmgH/koS96uVggM+5gw+qzDqd3eEOt+ntC+HM52EClB TF5w== X-Gm-Message-State: AOAM5329xRDdGCVbJTNoOfkHnOXlCcdcZsihj0jjAVdTmd643AFMerXW yIqiCaHbKFk0aDTGN4q9pCcI7A== X-Google-Smtp-Source: ABdhPJxXzTf5uqo/n1lvnQUbpw8pjt+YCW5eXmo2cQc7JcRVWidgnTeID6Y7vSeeIaE9SHOiXo/rOw== X-Received: by 2002:a05:6638:419e:: with SMTP id az30mr6102981jab.14.1629256075958; Tue, 17 Aug 2021 20:07:55 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o15sm2148658ilo.73.2021.08.17.20.07.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Aug 2021 20:07:55 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 68F23800C6F; Tue, 17 Aug 2021 22:07:54 -0500 (CDT) Date: Tue, 17 Aug 2021 22:07:54 -0500 From: Justin Pryzby To: Tomas Vondra Cc: Dean Rasheed , pgsql-hackers@postgresql.org, Michael Paquier , Peter Geoghegan , Andrew Dunstan Subject: Re: PoC/WIP: Extended statistics on expressions Message-ID: <20210818030754.GP10479@telsasoft.com> References: <3fbbd68b-0b52-cb5a-d468-7e7280c33e6c@enterprisedb.com> <4654037b-8df8-77fb-2981-67be93aebdf1@enterprisedb.com> <20201123022604.GD24052@telsasoft.com> <6455e0ad-2a2e-bdb0-e1f8-fd4983d1c8aa@enterprisedb.com> <087086de-1384-8374-4efc-2e7915071d5c@enterprisedb.com> <20210816013255.GS10479@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > Patch 0001 fixes the "double parens" issue discussed elsewhere in this > thread, and patch 0002 tweaks CREATE STATISTICS to treat "(a)" as a simple > column reference. > From: Tomas Vondra > Date: Mon, 16 Aug 2021 17:19:33 +0200 > Subject: [PATCH 2/2] fix: identify single-attribute references > diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl > index a4ee54d516..be1f3a5175 100644 > --- a/src/bin/pg_dump/t/002_pg_dump.pl > +++ b/src/bin/pg_dump/t/002_pg_dump.pl > @@ -2811,7 +2811,7 @@ my %tests = ( > create_sql => 'CREATE STATISTICS dump_test.test_ext_stats_expr > ON (2 * col1) FROM dump_test.test_fifth_table', > regexp => qr/^ > - \QCREATE STATISTICS dump_test.test_ext_stats_expr ON ((2 * col1)) FROM dump_test.test_fifth_table;\E > + \QCREATE STATISTICS dump_test.test_ext_stats_expr ON (2 * col1) FROM dump_test.test_fifth_table;\E This hunk should be in 0001, no ? > But I'm not sure 0002 is something we can do without catversion bump. What > if someone created such "bogus" statistics? It's mostly harmless, because > the statistics is useless anyway (AFAICS we'll just use the regular one we > have for the column), but if they do pg_dump, that'll fail because of this > new restriction. I think it's okay if it pg_dump throws an error, since the fix is as easy as dropping the stx object. (It wouldn't be okay if it silently misbehaved.) Andres concluded similarly with the reverted autovacuum patch: https://www.postgresql.org/message-id/20210817105022.e2t4rozkhqy2myhn@alap3.anarazel.de +RMT in case someone wants to argue otherwise. -- Justin