Re: Stored procedures and out parameters

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Robert Haas <robertmhaas(at)gmail(dot)com>, Shay Rojansky <roji(at)roji(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Stored procedures and out parameters
Date: 2018-07-24 17:16:35
Message-ID: CAB=Je-FewwzUi5TXHveqFCZUqi1xFg0+ikivW+D2UR6RKhJ1Cw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>to compensate for the decisions made by the JDBC driver PostgreSQL

It is not a decision by PostgreSQL JDBC driver. It is a decision by JDBC
(Java Database Connectivity) specification itself.
pgjdbc just follows the specification there.

Well, there's an initiative for a new JDBC specification (ADBA
https://blogs.oracle.com/java/jdbc-next:-a-new-asynchronous-api-for-connecting-to-a-database
),
and they seem to avoid "JDBC-specific syntax" in favour of
native-for-the-database syntax. However, ADBA is in its early development,
and there are lots of existing applications that use { call my_proc() }
syntax for a good reason.

>IMO JDBC will need to version branch the textual transform of {call} to
"CALL" in v11 and continue with the transform to SELECT in v10 and earlier.

Just one more time: it will break clients who use JDBC's {call ...} syntax
to call functions in v11.
In other words, JDBC specification does not distinguish procedures and
functions, so pgjdbc would have to use either "CALL procedure()" or "SELECT
procedure()" kind of native syntax, however pgjdbc has no clue which one to
use. Current PostgreSQL 11 fails to execute functions via CALL, and it
fails to execute procedures via SELECT.

Of course, application developer can use native syntax directly so
application can use CALL vs SELECT, however that has portability issues
since native syntax is tied to a single DB.
JDBC {call my_proc()} automatically expands to select... for PostgreSQL
and to begin my_proc(); end; in Oracle DB.

Vladimir

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2018-07-24 17:21:25 Re: Add SKIP LOCKED to VACUUM and ANALYZE
Previous Message Simon Riggs 2018-07-24 16:37:46 Re: Making "COPY partitioned_table FROM" faster