Hello,
Postgres 14 supports SQL standard conforming bodies for functions and procedures
which are no longer string constants, e.g.
create or replace procedure do_stuff()
language sql
begin atomic
select 1;
select 2;
end
However, it seems that the JDBC driver will parse the string and split it into
multiple statements based on the semicolons thus making it an invalid create procedure
statement.
The above CREATE statement runs fine in psql, but the following Java code:
Connection con = DriverManager.getConnection(...);
String sql =
"create or replace procedure do_stuff()\n" +
" language sql\n" +
" begin atomic\n" +
" select 1;\n" +
" select 2;\n" +
" end";
Statement stmt = con.createStatement();
stmt.execute(sql);
fails with:
org.postgresql.util.PSQLException: ERROR: syntax error at end of input
Position: 79
Position 79 is the semicolon after "select 1"
Is there a way to disable the parsing/splitting in the driver so that it will be possible
to run such statements?
This is important for JDBC based SQL client tools.
Regards
Thomas