Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhA9D-009wBA-At for pgsql-general@arkaria.postgresql.org; Mon, 04 Mar 2024 15:22:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rhA9B-008znO-TE for pgsql-general@arkaria.postgresql.org; Mon, 04 Mar 2024 15:22:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhA9B-008znG-Is for pgsql-general@lists.postgresql.org; Mon, 04 Mar 2024 15:22:34 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhA99-002jup-Da for pgsql-general@postgresql.org; Mon, 04 Mar 2024 15:22:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 424FMSQ73598578; Mon, 4 Mar 2024 10:22:28 -0500 From: Tom Lane To: =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= cc: PG-General Mailing List Subject: Re: postgres_fdw aggregate pushdown for group by with expressions In-reply-to: <5CE71232-CD60-4186-BBCB-2780D4C71F63@kleczek.org> References: <5FC17CB3-3048-455D-B638-B48949F78D06@kleczek.org> <3299634.1709487773@sss.pgh.pa.us> <5CE71232-CD60-4186-BBCB-2780D4C71F63@kleczek.org> Comments: In-reply-to =?utf-8?Q?Micha=C5=82_K=C5=82eczek?= message dated "Mon, 04 Mar 2024 07:46:33 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3598576.1709565748.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 04 Mar 2024 10:22:28 -0500 Message-ID: <3598577.1709565748@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =3D?utf-8?Q?Micha=3DC5=3D82_K=3DC5=3D82eczek?=3D writ= es: > Does that mean that *any* expression containing text constants is not go= ing to be pushed down?? > That would be a really serious issues I=E2=80=99d say. If it contains text constants and not text variables, possibly so. Keep in mind though that this rule is applied after constant-folding, so that what we're left with is normally going to contain variables at every level. extract() is problematic because it combines a text constant with a datetime (collation-less) variable. regards, tom lane