Re: One question about callablestatement

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: 张元超 <zhangyuanchao(at)highgo(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: One question about callablestatement
Date: 2016-01-20 14:08:43
Message-ID: CADK3HHKJTnAO5Cfacih2E5+haahQgmaL=Ejzc1mMHneR4aMiYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Yes we would not expect you to use a } in a function name. Is this
absolutely necessary ?

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On 19 January 2016 at 21:14, 张元超 <zhangyuanchao(at)highgo(dot)com> wrote:

> Hi,
> Now ,i found one question about callablestatement.if i have a function
> whoes name containts '}',and i call it by callablestatement,there will be a
> 'PSQLException'. Like this:
>
> org.postgresql.util.PSQLException: Malformed function or procedure
> escape syntax at offset 19.
> at org.postgresql.core.Parser.modifyJdbcCall(Parser.java:644)
> at
> org.postgresql.jdbc2.CachedQueryCreateAction.create(CachedQueryCreateAction.java:40)
> at
> org.postgresql.jdbc2.CachedQueryCreateAction.create(CachedQueryCreateAction.java:21)
> at org.postgresql.util.LruCache.borrow(LruCache.java:94)
> at
> org.postgresql.jdbc2.AbstractJdbc2Connection.borrowQuery(AbstractJdbc2Connection.java:106)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.<init>(AbstractJdbc2Statement.java:227)
> at
> org.postgresql.jdbc3.AbstractJdbc3Statement.<init>(AbstractJdbc3Statement.java:49)
> at
> org.postgresql.jdbc3g.AbstractJdbc3gStatement.<init>(AbstractJdbc3gStatement.java:29)
> at
> org.postgresql.jdbc4.AbstractJdbc4Statement.<init>(AbstractJdbc4Statement.java:33)
> at
> org.postgresql.jdbc42.AbstractJdbc42Statement.<init>(AbstractJdbc42Statement.java:27)
> at org.postgresql.jdbc42.Jdbc42Statement.<init>(Jdbc42Statement.java:31)
> at
> org.postgresql.jdbc42.Jdbc42PreparedStatement.<init>(Jdbc42PreparedStatement.java:21)
> at
> org.postgresql.jdbc42.Jdbc42CallableStatement.<init>(Jdbc42CallableStatement.java:17)
> at
> org.postgresql.jdbc42.Jdbc42Connection.prepareCall(Jdbc42Connection.java:46)
> at
> org.postgresql.jdbc3.AbstractJdbc3Connection.prepareCall(AbstractJdbc3Connection.java:325)
> at
> org.postgresql.jdbc2.AbstractJdbc2Connection.prepareCall(AbstractJdbc2Connection.java:333)
>
> The function name i used is "test_fu}n2".Yeah,i kown that may be nobody
> will create a function with some name like this,but, it can be created
> successfully.Ok, i check the code of jdbc,i found some problem lead to the
> question above. The code file is org/postgresql/core/Parser.java,and row
> 603 to row 646,the handle of '}' .
>
> I have no idea if it is necessary to modify it.
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Pavel Raiskup 2016-01-20 14:37:45 Step towards being able to build on Linux (Pull request #435)
Previous Message Vladimir Sitnikov 2016-01-20 13:48:17 Re: [pgjdbc] Implement JDBC specs via pre-processor step (#435)