Search Postgresql Archives

Re: Why can't I have a "language sql" anonymous block?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



david.g.johnston@xxxxxxxxx wrote:

On Monday, December 13, 2021, Bryn Llewellyn <bryn@xxxxxxxxxxxx> wrote:

There must be a reason to prefer a “language sql” procedure over a “language plpgsql” procedure—otherwise the former wouldn’t be supported.

I would say that is true for functions.  I wouldn’t assume that for procedures—it’s probable that because sql already worked for functions we got that feature for free when implementing procedures.

Interesting. That’s exactly the kind of historical insight I was after. Thanks.

It’s very tempting to think that “language sql” is meaningful only as a performance feature and in that connection only for a stored function because only a function can be inlined in a surrounding regular SQL statement. (You can invoke a procedure only as a singleton in the dedicated “call” statement.) In other words there can be no inlining benefit for a stored procedure. 

It’s certainly no problem for the coder to bracket what would have been the body of a “language sql” DO block with a single “begin… end;”.

I should save any of you the effort of telling me this: a DO block is an anonymous, ephemeral procedure. It’s certainly not an anonymous function.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux