Exception using dollar-quoted string

Поиск
Список
Период
Сортировка
От Fichtenelch
Тема Exception using dollar-quoted string
Дата
Msg-id 000201c64f61$88342aa0$1530a8c0@hgworkstation0
обсуждение исходный текст
Ответы Re: Exception using dollar-quoted string
Re: Exception using dollar-quoted string
Список pgsql-jdbc
Hi,

when I'm trying to execute the following command with a java.sql.Statement
an error occurs:

CREATE OR REPLACE FUNCTION test(text) RETURNS void AS $$ DECLARE tmp text;
BEGIN tmp := 'test'; END; $$ LANGUAGE plpgsql;

org.postgresql.util.PSQLException: ERROR: unterminated dollar-quoted string
at or near "$$ DECLARE tmp text"
    at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorI
mpl.java:1512)
    at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.ja
va:1297)
    at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
    at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:437)
    at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2St
atement.java:339)
    at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:331)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.postgresql.ds.common.PooledConnectionImpl$StatementHandler.invoke(Pooled
ConnectionImpl.java:467)
    at $Proxy2.execute(Unknown Source)

The command: CREATE OR REPLACE FUNCTION test(text) RETURNS void AS ' DECLARE
tmp text; BEGIN tmp := "test"; END; ' LANGUAGE plpgsql;

works fine, also creating the function with php (phppgadmin). I have the
latest version of the jdbc driver.
Is this a bug, or my fault?

Thanks,
Fichtenelch



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

Предыдущее
От: "Xavier Poinsard"
Дата:
Сообщение: Re: Patch implementing escaped functions timestampadd and
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Exception using dollar-quoted string