pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: SQL-standard function body
Date: Tue, 30 Jun 2020 14:24:40 -0400
Message-ID: <493812.1593541480@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZ-FXU0iyevFETN0sGYw0RKTSCFxKONGE+2nVJEM5_8OQ@mail.gmail.com>
References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com>
	<CA+TgmoZ-FXU0iyevFETN0sGYw0RKTSCFxKONGE+2nVJEM5_8OQ@mail.gmail.com>

Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Jun 30, 2020 at 1:49 PM Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>> This adds support for writing CREATE FUNCTION and CREATE PROCEDURE
>> statements for language SQL with a function body that conforms to the
>> SQL standard and is portable to other implementations.

> With what other implementations is it compatible?

Yeah ... I'm sort of wondering exactly what this really accomplishes.
I think "portability" is a red herring unfortunately.

Tracking the dependencies of the function body sounds nice at first
glance, so it might be a feature.  But given our experiences with having
to use check_function_bodies = off to not have impossible dependency loops
in dump/restore, I rather wonder whether it'll be a net loss in practice.
IIUC, this implementation is flat out incapable of doing the equivalent of
check_function_bodies = off, and that sounds like trouble.

> Hmm, this all seems like a pretty big semantic change. IIUC, right
> now, a SQL function can only contain one statement,

Not true, you can have more.  However, it's nonetheless an enormous
semantic change, if only because the CREATE FUNCTION-time search_path
is now relevant instead of the execution-time path.  That *will*
break use-cases I've heard of, where the same function is applied
to different tables by adjusting the path.  It'd certainly be useful
from some perspectives (eg better security), but it's ... different.

Replicating the creation-time search path will be a big headache for
pg_dump, I bet.

> But it almost seems like you are
> inventing a whole new PL....

Yes.  Having this replace the existing SQL PL would be a disaster,
because there are use-cases this simply can't meet (even assuming
that we can fix the polymorphism problem, which seems a bit unlikely).
We'd need to treat it as a new PL type.

Perhaps this is useful enough to justify all the work involved,
but I'm not sure.

			regards, tom lane





view thread (90+ messages)  latest in thread

Message-ID: <493812.1593541480@sss.pgh.pa.us>
Permalink:  ../493812.1593541480@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/493812.1593541480@sss.pgh.pa.us

 · 

reply

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, peter.eisentraut@2ndquadrant.com
  Subject: Re: SQL-standard function body
  In-Reply-To: <493812.1593541480@sss.pgh.pa.us>
  References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com> <CA+TgmoZ-FXU0iyevFETN0sGYw0RKTSCFxKONGE+2nVJEM5_8OQ@mail.gmail.com> <493812.1593541480@sss.pgh.pa.us>

* 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