From: Bryn Llewellyn <bryn@yugabyte.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Merlin Moncure <mmoncure@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Why can't I have a "language sql" anonymous block?
Date: Thu, 16 Dec 2021 11:21:56 -0800
Message-ID: <17CC26DF-1B53-4ECF-A0AF-6203D81F19AA@yugabyte.com> (raw)
In-Reply-To: <CAKFQuwZh6+1s1xm0txtKEnOEL48q2M9avAYxb3X0GP5D4BsGAw@mail.gmail.com>
References: <C9838A29-8C84-4F68-9C41-5CB4665911E5@yugabyte.com>
<872342.1639428817@sss.pgh.pa.us>
<FBBBFEDF-4023-4A38-B1BE-FC07423E0C46@yugabyte.com>
<CAKFQuwa0XH7bQxycTSw8FiBbwcsEKxOSKZt=q-XemfR0uyjyZA@mail.gmail.com>
<25643215-899C-4FF8-A35F-85A61A8AD0A5@yugabyte.com>
<CAHyXU0wwfWD2HaFoCkriLw-WBzoqLL5tC=URTsp2_obemyrWhA@mail.gmail.com>
<FEC01136-F44B-4DD6-B744-23D62B610A1A@yugabyte.com>
<39ae120c-ec62-1833-1104-d45030491b45@aklaver.com>
<CAKFQuwaFyVbaY+SyyuDPR6gBgBivJPAf9_tPRwyUDun-tj7gJg@mail.gmail.com>
<44C88BA4-02D8-41BE-A187-724C3D827422@yugabyte.com>
<CAKFQuwZh6+1s1xm0txtKEnOEL48q2M9avAYxb3X0GP5D4BsGAw@mail.gmail.com>
> david.g.johnston@gmail.com wrote:
>
>> bryn@yugabyte.com wrote:
>>
>> Re your paragraph #2, I already made the case for anonymous procedures. And I said that, to deserve the name, they must allow parameterization. They bring their value in a certain kind of scripting where you want to do stuff but leave no secondary traces. Plus the point about whether you even have the privilege to create objects. However, nobody here was convinced by this thinking.
>
>
> I’d suggest if you want to debate the merits of having DO accept input arguments that you start a new thread for that; as it is only loosely related to the subject line for this thread. I’m not seeing any positions being given that such a capability would be undesirable.
>
> All anyone is saying is that our best, untested, guesses are that the benefit/cost ratio of simply making “DO/LANGUAGE SQL” work, without any scope creep, is very low—namely because the benefit seems small regardless of the cost. I'm doubtful anyone has bothered to try and measure the cost. As for the benefit, I’m doubting the anonymous aspect of this makes much difference so an interested party can fairly easily use CREATE PROCEDURE to generate some actual performance data and at least plausibly argue that the results would carry over to “DO”.
>
>> bryn continued:
>>
>> I do think that it’s risky to dismiss as valueless some feature that, for example, Oracle Database has (and has had since the dawn of time), and that PG lacks, unless the feature is intertwined with specific aspects of the other environment that have no counterpart in PG. The extreme example of this thinking is to dismiss the notion of PL/pgSQL packages and inner procedures as valueless except in that they might ease migrations from Oracle Database to PG.
>
> [If I understand correctly] at least one of the larger contributors to PostgreSQL, and some individuals, are deeply involved with the service of transitioning clients from Oracle to PostgreSQL. I personally don't worry about weighting my interpretations based upon that external factor but simply evaluate it within the scope and reality I observe within the PostgreSQL hacker community.
Thanks, David. Yes, mea culpa. I muddied the discussion so that the “Subject” line no longer reflects the content.
W.r.t. my initial question (“Why can’t I have a ‘language sql’ anonymous block?”), I’m going to say “case closed”. The various answers that I’ve read have shown me that “language sql” can bring only a possible performance benefit and can do this only for a function ‘cos only a function can have its body inlined into the SQL statement that invokes it.
I’ll start a new thread on parameters for anonymous blocks, inner subprograms and packages for PL/pgSQL stored functions and procedures.=
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: bryn@yugabyte.com, david.g.johnston@gmail.com, adrian.klaver@aklaver.com, mmoncure@gmail.com
Subject: Re: Why can't I have a "language sql" anonymous block?
In-Reply-To: <17CC26DF-1B53-4ECF-A0AF-6203D81F19AA@yugabyte.com>
References: <C9838A29-8C84-4F68-9C41-5CB4665911E5@yugabyte.com> <872342.1639428817@sss.pgh.pa.us> <FBBBFEDF-4023-4A38-B1BE-FC07423E0C46@yugabyte.com> <CAKFQuwa0XH7bQxycTSw8FiBbwcsEKxOSKZt=q-XemfR0uyjyZA@mail.gmail.com> <25643215-899C-4FF8-A35F-85A61A8AD0A5@yugabyte.com> <CAHyXU0wwfWD2HaFoCkriLw-WBzoqLL5tC=URTsp2_obemyrWhA@mail.gmail.com> <FEC01136-F44B-4DD6-B744-23D62B610A1A@yugabyte.com> <39ae120c-ec62-1833-1104-d45030491b45@aklaver.com> <CAKFQuwaFyVbaY+SyyuDPR6gBgBivJPAf9_tPRwyUDun-tj7gJg@mail.gmail.com> <44C88BA4-02D8-41BE-A187-724C3D827422@yugabyte.com> <CAKFQuwZh6+1s1xm0txtKEnOEL48q2M9avAYxb3X0GP5D4BsGAw@mail.gmail.com> <17CC26DF-1B53-4ECF-A0AF-6203D81F19AA@yugabyte.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox