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 1mxwKK-0005Zo-Qm for pgsql-general@arkaria.postgresql.org; Thu, 16 Dec 2021 19:22:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mxwKJ-0007dH-Jl for pgsql-general@arkaria.postgresql.org; Thu, 16 Dec 2021 19:22:03 +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 1mxwKJ-0007d7-7H for pgsql-general@lists.postgresql.org; Thu, 16 Dec 2021 19:22:03 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mxwKG-0005fH-Ps for pgsql-general@lists.postgresql.org; Thu, 16 Dec 2021 19:22:02 +0000 Received: by mail-pg1-x536.google.com with SMTP id r138so23824379pgr.13 for ; Thu, 16 Dec 2021 11:22:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yugabyte.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=acIETGt2WKgU8vIMK2+1By/wOAkOjIJlw6Nq6gBxkfg=; b=eZPz/LG5LXwujMDf4uOvJC9xwQvAAUTKKpGYqH0/7aGMBB80JvesGdzdYl0izpRyRO TbB5Zmi7PkL8qZMWsWwsgF5etmEpy7YOFLYrKDl8C72DK++rM9Dd5IftpQGXIw+d6I8z QARi4S/gEZVxiPI80IhdkkGpkKyKc6mV+J3aw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=acIETGt2WKgU8vIMK2+1By/wOAkOjIJlw6Nq6gBxkfg=; b=v15YpcbUGf2Zni54wCexCYB8cTF7ZvCE0Hf9/zy4RhXInqlRWQpMZbL9+2GOF1NT/C P6KUzhyirZnWWvQybHoClTQTkHlnAp18uYkl1kfMGts2+/fcnb7BO+qmPlGOelQAHBbu eiiNMH7Lda+pJmQjQwWhEhUg4eBMtqeLdeKp3SwVGasHVsnCynWwj16VzTCt/Hv1t0Ll 9fCHCDaGGgjc080rceYIkUvZLdwdNz48PqApBwBpznoS80Ets8NUbmpz+nTtvfDpHbeD hANbdwk53bOaeK64G3iYwa6ooQnKWX0enQDW/+A5FoA1Up44gFVXD9jBuEq8b4MA16cy 8r/w== X-Gm-Message-State: AOAM531XWaO8+OjfRMaRM3VRAQU9nA1jgvlVQQx/8LqJHSzRWfhbdBdn 8KcAA9jlX+zr2shBaiGaH+Noig== X-Google-Smtp-Source: ABdhPJwdaAn5umLc39zGe4AavzGPWFAExfKpuB1v0kjdVz9njn4ILPSqa2rUONZedJyitAtVsSo7Ew== X-Received: by 2002:a63:fc58:: with SMTP id r24mr13023735pgk.342.1639682517962; Thu, 16 Dec 2021 11:21:57 -0800 (PST) Received: from smtpclient.apple ([2601:646:101:7fda:a8ad:d8b5:7616:591f]) by smtp.gmail.com with ESMTPSA id l186sm6000928pga.24.2021.12.16.11.21.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Dec 2021 11:21:57 -0800 (PST) From: Bryn Llewellyn Message-Id: <17CC26DF-1B53-4ECF-A0AF-6203D81F19AA@yugabyte.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_9B83AFA4-2F60-43BF-88BF-941EC3D8D1D8" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Why can't I have a "language sql" anonymous block? Date: Thu, 16 Dec 2021 11:21:56 -0800 In-Reply-To: Cc: Adrian Klaver , Merlin Moncure , pgsql-general list To: "David G. Johnston" References: <872342.1639428817@sss.pgh.pa.us> <25643215-899C-4FF8-A35F-85A61A8AD0A5@yugabyte.com> <39ae120c-ec62-1833-1104-d45030491b45@aklaver.com> <44C88BA4-02D8-41BE-A187-724C3D827422@yugabyte.com> X-Mailer: Apple Mail (2.3654.120.0.1.13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_9B83AFA4-2F60-43BF-88BF-941EC3D8D1D8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > david.g.johnston@gmail.com wrote: >=20 >> bryn@yugabyte.com wrote: >>=20 >> 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. >=20 >=20 > I=E2=80=99d 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=E2=80=99m = not seeing any positions being given that such a capability would be = undesirable. >=20 > All anyone is saying is that our best, untested, guesses are that the = benefit/cost ratio of simply making =E2=80=9CDO/LANGUAGE SQL=E2=80=9D = work, without any scope creep, is very low=E2=80=94namely 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=E2=80=99m = 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 =E2=80=9CDO=E2=80=9D.=20 > =20 >> bryn continued: >>=20 >> I do think that it=E2=80=99s 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. >=20 > [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 = =E2=80=9CSubject=E2=80=9D line no longer reflects the content. W.r.t. my initial question (=E2=80=9CWhy can=E2=80=99t I have a = =E2=80=98language sql=E2=80=99 anonymous block?=E2=80=9D), I=E2=80=99m = going to say =E2=80=9Ccase closed=E2=80=9D. The various answers that = I=E2=80=99ve read have shown me that =E2=80=9Clanguage sql=E2=80=9D can = bring only a possible performance benefit and can do this only for a = function =E2=80=98cos only a function can have its body inlined into the = SQL statement that invokes it. I=E2=80=99ll start a new thread on parameters for anonymous blocks, = inner subprograms and packages for PL/pgSQL stored functions and = procedures.= --Apple-Mail=_9B83AFA4-2F60-43BF-88BF-941EC3D8D1D8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
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=E2=80=99d = 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=E2=80=99m 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 =E2=80=9CDO/LANGUAGE = SQL=E2=80=9D work, without any scope creep, is very = low=E2=80=94namely 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=E2=80=99m 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 =E2=80=9CDO=E2=80=9D. 
 
bryn = continued:

I do think that it=E2=80=99s = 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 =E2=80=9CSubject=E2=80=9D = line no longer reflects the content.

W.r.t. my initial question (=E2=80=9CWhy = can=E2=80=99t I have a =E2=80=98language sql=E2=80=99 anonymous = block?=E2=80=9D), I=E2=80=99m going to say =E2=80=9Ccase closed=E2=80=9D. = The various answers that I=E2=80=99ve read have shown me that = =E2=80=9Clanguage sql=E2=80=9D can bring only a possible performance = benefit and can do this only for a function =E2=80=98cos only a function = can have its body inlined into the SQL statement that invokes = it.

I=E2=80=99ll= start a new thread on parameters for anonymous blocks, inner = subprograms and packages for PL/pgSQL stored functions and = procedures.
= --Apple-Mail=_9B83AFA4-2F60-43BF-88BF-941EC3D8D1D8--