From: Martijn Tonies \(Upscene Productions\) <m.tonies@upscene.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Stored procedure code no longer stored in v14 and v15, changed behaviour
Date: Mon, 5 Dec 2022 11:48:53 +0100
Message-ID: <2D11774D730A443FA99475517FDAFA7C@MARTIJNWS> (raw)
In-Reply-To: <CAM8SmLUkqN2dkBAjSjMLLMXikXb8ExY3cbYwE+YsLxcRkmoE_Q@mail.gmail.com>
References: <23DE96C56DFC404096553A22DDC5093B@MARTIJNWS>
<CAKFQuwbYCk0oA3VT+ngEebBTBjdtGsVLEFOdPX2qqQJobA7rtg@mail.gmail.com>
<1579912.1669908194@sss.pgh.pa.us>
<CAFCRh--K2tahGetbJ_mtjiwvfFb9fF6SzjGnvbyoMKPr92FiTQ@mail.gmail.com>
<c14b49a2043adafbe9589fab7af4eceb6199726c.camel@cybertec.at>
<CAFCRh-8DBZdfq_r+5jX9s8XPGxrANCOuWffkBBadpRTm7VP-OA@mail.gmail.com>
<bee36d64-84e3-2918-9183-6035e1e6e221@aklaver.com>
<CAFCRh-_wTu8mdxurTgjVO0Z19Xs1sam0ZFQqdXAJ5eF+7NLkpA@mail.gmail.com>
<661B1D571A89455FAE64C8F316D1EAA3@MARTIJNWS>
<a60a3f60d791cc0291deafc775ffdbb2a6161c56.camel@cybertec.at>
<CAFCRh--YRinDnUPAKrZuxj3R1RdQZRVAk8dZQy0i_W1DKHrNwA@mail.gmail.com>
<CAM8SmLUkqN2dkBAjSjMLLMXikXb8ExY3cbYwE+YsLxcRkmoE_Q@mail.gmail.com>
Hello Jeremy,
Yes and no
For Stored Functions, the “sql_body” can either be a block with BEGIN ATOMIC ... END or a single statement RETURN expression;
For a Stored Procedure, the “sql_body” is always the block.
Using “language SQL” and an “sql_body” (as per documentation) is certainly easier (no string constant) and more compatible with the SQL standard. But if you do so, you loose the possibility to retrieve your actual code from the database, which, IMO, is very counter intuitive.
Lots of people use, how shall we call it, ‘interactive development’ in tools (like the one we create) and instead of running a saved and modified script, you load the objects from the database, you modify it in a database development tool, test, modify, test etc.
I understand that dependency tracking is useful, and automatic object modification when doing object renaming is nice, but personally, that would be a corner case compared to day-to-day development of stored code.
With regards,
Martijn Tonies
Upscene Productions
https://www.upscene.com
Database Workbench - developer tool for Oracle, SQL Server, PostgreSQL, MySQL, InterBase, NexusDB and Firebird.
From: Jeremy Smith
Sent: Friday, December 2, 2022 3:10 PM
To: pgsql-general@lists.postgresql.org
Subject: Re: Stored procedure code no longer stored in v14 and v15, changed behaviour
From a user point of view, can also be seen as a "regression",
when an observable property of the system changes to a new
different / incompatible way, to some extent. I'm not saying it is,
still it is a change one discovers too late, creates pain to some,
and is both worth reporting and discussing.
Isn't this only true if you use the new sql_body/BEGIN ATOMIC syntax, though? Can't you keep using the older AS 'definition' syntax and still get the body of the function, unchanged, in the prosrc column? You would, of course, lose the benefit of the dependency tracking. As a user, though, I don't find it surprising that creating a function using new syntax specifically designed to provide dependency tracking would change the way the function is stored internally.
To me, the new syntax gives the same benefits and drawbacks to SQL functions that we already have with views, which are also re-written on creation.
-Jeremy
Attachments:wlEmoticon-winkingsmile[1].png (image/png, 1.1K) downloadview image
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: m.tonies@upscene.com
Subject: Re: Stored procedure code no longer stored in v14 and v15, changed behaviour
In-Reply-To: <2D11774D730A443FA99475517FDAFA7C@MARTIJNWS>
References: <23DE96C56DFC404096553A22DDC5093B@MARTIJNWS> <CAKFQuwbYCk0oA3VT+ngEebBTBjdtGsVLEFOdPX2qqQJobA7rtg@mail.gmail.com> <1579912.1669908194@sss.pgh.pa.us> <CAFCRh--K2tahGetbJ_mtjiwvfFb9fF6SzjGnvbyoMKPr92FiTQ@mail.gmail.com> <c14b49a2043adafbe9589fab7af4eceb6199726c.camel@cybertec.at> <CAFCRh-8DBZdfq_r+5jX9s8XPGxrANCOuWffkBBadpRTm7VP-OA@mail.gmail.com> <bee36d64-84e3-2918-9183-6035e1e6e221@aklaver.com> <CAFCRh-_wTu8mdxurTgjVO0Z19Xs1sam0ZFQqdXAJ5eF+7NLkpA@mail.gmail.com> <661B1D571A89455FAE64C8F316D1EAA3@MARTIJNWS> <a60a3f60d791cc0291deafc775ffdbb2a6161c56.camel@cybertec.at> <CAFCRh--YRinDnUPAKrZuxj3R1RdQZRVAk8dZQy0i_W1DKHrNwA@mail.gmail.com> <CAM8SmLUkqN2dkBAjSjMLLMXikXb8ExY3cbYwE+YsLxcRkmoE_Q@mail.gmail.com> <2D11774D730A443FA99475517FDAFA7C@MARTIJNWS>
* 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