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 1nLkMB-0007Uc-KK for pgsql-general@arkaria.postgresql.org; Sun, 20 Feb 2022 11:26:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLkM8-0001HY-KM for pgsql-general@arkaria.postgresql.org; Sun, 20 Feb 2022 11:26:20 +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 1nLkM8-0001HO-7g for pgsql-general@lists.postgresql.org; Sun, 20 Feb 2022 11:26:20 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nLkM6-00038c-LE for pgsql-general@lists.postgresql.org; Sun, 20 Feb 2022 11:26:19 +0000 Received: by mail-ed1-x534.google.com with SMTP id c6so20914808edk.12 for ; Sun, 20 Feb 2022 03:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jZzShWHtcMYLMk5Q5g9pkIPVMnGDpwDTvV5rj1+LTPo=; b=IxAZfqSs9a1CVcsP+yJMEEI8c2Ps4qmZO7xfwdND/uFsdjfNf9FRHgPOvShiHVMsvZ /cNn29O4EADORwWZ7T25d/bu9udS+3A8emICm9CkqVTkoo6qLLUAqqPKocr+/NZGFbbP feA6o5OAaE1+sqr66a3w79+IklYmN+gAHSm4gf9llXf4Ckf57XS2kJ1YDmBwpIVNKr5q ZVdsOWi0jQLyh0wFO1OXsLFfCcnAisr0Cj6ZbZzX6ISVH0JzpwBCm+5DmI7TFOfJctjU fowDs0KlN3Nk41xx8h8QrNUdkotSFTATU3FXrWeThUnqnaiTHO+YoWnFYn/CyXxyjhyC 7p4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jZzShWHtcMYLMk5Q5g9pkIPVMnGDpwDTvV5rj1+LTPo=; b=c780b5GHaBYphDr8+2WjCZkQNDTgb3k+fLsY2VYyKAq0MWNNqyL28Wp3hgKzyDZ/+e Fwebnra3sOnV3+OHLbSO889f6/M8l/xR8lldECRDywBWrewpAJU+tuCM3oL/A8DW0B56 Re/4x9YrMPSj47nB3TJZzkwpWiEtVt5lDeVx09U/8jfqbWUMrt4vxZvJOpojI+aFkZbo ZE6rMFEmCTM4YX3OtnOVNWfDcbYhF/lySUFEU4c1qFJ20ZgAaFvupjyHuEmcEy46P6cg lZpYjCvz1aorTjBOELlyYZhjla4ufZVz/gVY5kepC6MQolG43BazoOvcHiJgw00Detiw RI5A== X-Gm-Message-State: AOAM5322GCZXdALMEzAkK4vMEVlHj0AfxTWNNl8wGG/jxXVZKaIp0PXY 3ttMNqtzz3CJo6WvBmga3rQ= X-Google-Smtp-Source: ABdhPJzCJfj7yDO39vZ5h0VkVHGuzfynsKktKoi1N2axwAmZWj1U4RFehVKT3jHXy2yNRFznnESy8g== X-Received: by 2002:a50:ec81:0:b0:410:ae5d:88f6 with SMTP id e1-20020a50ec81000000b00410ae5d88f6mr16672917edr.261.1645356377751; Sun, 20 Feb 2022 03:26:17 -0800 (PST) Received: from smtpclient.apple (ppp-94-66-221-132.home.otenet.gr. [94.66.221.132]) by smtp.gmail.com with ESMTPSA id nc40sm1785265ejc.127.2022.02.20.03.26.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Feb 2022 03:26:16 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: Additional accessors via the Extension API ? From: Markur Sens In-Reply-To: <20220220103508.il2a3fpaeeys3mt3@jrouhaud> Date: Sun, 20 Feb 2022 13:26:15 +0200 Cc: pgsql-general Content-Transfer-Encoding: quoted-printable Message-Id: <92035310-DA8B-4EEF-84CD-2BEC989866B5@gmail.com> References: <6D4DE1F2-70C9-4BC4-92FD-0699BE0F8952@gmail.com> <20220220101257.dchizxpkang7vvq4@jrouhaud> <2C9AEE7B-89A0-49F6-AB28-F81AEC9B6078@gmail.com> <20220220103508.il2a3fpaeeys3mt3@jrouhaud> To: Julien Rouhaud X-Mailer: Apple Mail (2.3693.60.0.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 20 Feb 2022, at 12:35 PM, Julien Rouhaud = wrote: >=20 > On Sun, Feb 20, 2022 at 12:31:22PM +0200, Markur Sens wrote: >>>=20 >>> Maybe you could rely on some old grammar hack to have something a = bit similar, >>> as (expr).funcname is an alias for funcname(expr). For instance: >>=20 >> Is this documented & expected behavior or it=E2=80=99s just happens = to work? >=20 > I don't think it's documented but it's an expected behavior, see >=20 > = https://github.com/postgres/postgres/blob/master/src/backend/parser/parse_= func.c#L57-L88 >=20 Ah thanks for this > /* > * Parse a function call > * > * For historical reasons, Postgres tries to treat the notations = tab.col > * and col(tab) as equivalent: if a single-argument function call = has an > * argument of complex type and the (unqualified) function name = matches > * any attribute of the type, we can interpret it as a column = projection. and the (unqualified) function name matches * any attribute of the type, we can interpret it as a column = projection. > * Conversely a function of a single complex-type argument can be = written > * like a column reference, allowing functions to act like computed = columns. > * > * If both interpretations are possible, we prefer the one matching = the > * syntactic form, but otherwise the form does not matter. > * > * Hence, both cases come through here. If fn is null, we're = dealing with > * column syntax not function syntax. In the function-syntax case, > * the FuncCall struct is needed to carry various decoration that = applies > * to aggregate and window functions. > [...]