Re: Stored procedures and out parameters

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Shay Rojansky <roji(at)roji(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, daniel(at)manitou-mail(dot)org, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Stored procedures and out parameters
Date: 2018-08-16 17:02:10
Message-ID: CAB=Je-Ey9XMvwigVc5pDQ6_zUTndHCr7t3pk73aQv6YcgrGVOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter>I am familiar with the Java {call} escape. But I think it's pretty
Peter>useless. You're not going to get any compatibility with anything from
Peter>it, since every SQL implementation does something different with it

Would you please be more specific?

{ call ... } converts the SQL to the database-specific way of calling a
stored procedure or whatever.

For instance, in Oracle DB one can have both procedures and functions.
{ ? := call my_fun() } is converted to something like begin :b0 :=
my_fun(); end;
{ call my_proc(?) } is converted to begin my_proc(:b0); end;

Then comes PostgreSQL, and says: you can't invoke functions/procedures like
{call my_proc()}.
This not fun at all.

Note: it is not a speculation, but I have participated in extending
OracleDB-kind-of-app to PostgreSQL, and {call ...} was used there for a
good reason.

{call ...} are used in lots of places exactly for the reason to call
procedures.
You don't need to correct application core, and one just needs to install
the procedure/function at the database side,
then it should just work.
However, current state of PostgreSQL 11 blocks use of database-independent
API.

Peter>If you want to call
Peter>a procedure (created with CREATE PROCEDURE), just invoke CALL directly
Peter>without any escape syntax.

That would truly surprise end users, and it would make application
portability a pain.

Vladimir

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vladimir Sitnikov 2018-08-16 17:08:20 Re: Stored procedures and out parameters
Previous Message Peter Eisentraut 2018-08-16 16:49:29 Re: Stored procedures and out parameters