Can't run CREATE PROCEDURE with new Postgres' 14 new SQL-standard body

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Can't run CREATE PROCEDURE with new Postgres' 14 new SQL-standard body
Дата
Msg-id 582e5837-d639-d774-5a6a-b778d91b2ec1@gmx.net
обсуждение исходный текст
Ответы Re: Can't run CREATE PROCEDURE with new Postgres' 14 new SQL-standard body  (Sehrope Sarkuni <sehrope@jackdb.com>)
Список pgsql-jdbc
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







В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Mark Rotteveel
Дата:
Сообщение: Re: JDBC Meta-data performance for Foreign Keys
Следующее
От: "ldh@laurent-hasson.com"
Дата:
Сообщение: RE: JDBC Meta-data performance for Foreign Keys