pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedOne question about callablestatement
3+ messages / 3 participants
[nested] [flat]
* One question about callablestatement
@ 2016-01-20 02:14 张元超 <zhangyuanchao@highgo.com>
0 siblings, 2 replies; 3+ messages in thread
From: 张元超 @ 2016-01-20 02:14 UTC (permalink / raw)
To: pgsql-jdbc
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: One question about callablestatement
@ 2016-01-20 14:08 Dave Cramer <pg@fastcrypt.com>
parent: 张元超 <zhangyuanchao@highgo.com>
1 sibling, 0 replies; 3+ messages in thread
From: Dave Cramer @ 2016-01-20 14:08 UTC (permalink / raw)
To: 张元超 <zhangyuanchao@highgo.com>; +Cc: pgsql-jdbc
Yes we would not expect you to use a } in a function name. Is this
absolutely necessary ?
Dave Cramer
davec@postgresintl.com
www.postgresintl.com
On 19 January 2016 at 21:14, 张元超 <zhangyuanchao@highgo.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.
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: One question about callablestatement
@ 2016-01-20 16:07 Thomas Kellerer <spam_eater@gmx.net>
parent: 张元超 <zhangyuanchao@highgo.com>
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Kellerer @ 2016-01-20 16:07 UTC (permalink / raw)
To: pgsql-jdbc
张元超 schrieb am 20.01.2016 um 03:14:
> 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:
>
> 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 '}' .
>
You don't need a CallableStatement to call a function in Postgres.
What happens if you use a regular Statement and executeQuery("select \"test_fu}n2\"");
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-01-20 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 02:14 One question about callablestatement 张元超 <zhangyuanchao@highgo.com>
2016-01-20 14:08 ` Dave Cramer <pg@fastcrypt.com>
2016-01-20 16:07 ` Thomas Kellerer <spam_eater@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox