pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
about function overload,a bug?
3+ messages / 2 participants
[nested] [flat]

* about function overload,a bug?
@ 2007-10-28 18:56  cncinfo@126.com <cncinfo@126.com>
  0 siblings, 1 reply; 3+ messages in thread

From: cncinfo@126.com @ 2007-10-28 18:56 UTC (permalink / raw)
  To: pgsql-jdbc

My English is bad.
I write two functions with plpgsql:

1. user_chgpasswd(character varying, character varying, timestamp
without time zone)
Note:content of the function is just "return 0;"
2.user_chgpasswd(character varying, character varying, character
varying)

Both of them return integer.
I invoke the first one in pgadmin,returns 0;but in my
application(setString(),setString(),setTimestamp()),the result is not 0.
I tried postgresql-8.2-506.jdbc3.jar and
postgresql-8.2-506.jdbc4.jar,both wrong.
I check my code for a long time,no wrong.I delete the second function in
postgresql and run my application again,returns 0.
It seems "timestamp without time zone" is same as "character varying" in
jdbc,so jdbc invoke wrong function.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: about function overload,a bug?
@ 2007-10-28 20:44  Oliver Jowett <oliver@opencloud.com>
  parent: cncinfo@126.com <cncinfo@126.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Oliver Jowett @ 2007-10-28 20:44 UTC (permalink / raw)
  To: cncinfo@126.com; +Cc: pgsql-jdbc

cncinfo@126.com wrote:

> It seems "timestamp without time zone" is same as "character varying" in
> jdbc,so jdbc invoke wrong function.

Unfortunately the JDBC driver must pass timestamp parameters without 
type data and let the server infer the correct type to use (this is 
necessary to have both "timestamp with time zone" and "timestamp without 
time zone" operate correctly).

In your case the server is inferring the wrong type for what you want.

An explicit cast in your query may fix it.

-O



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: about function overload,a bug?
@ 2007-10-29 03:29  cncinfo@126.com <cncinfo@126.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 3+ messages in thread

From: cncinfo@126.com @ 2007-10-29 03:29 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc

to 


Oliver Jowett
Thanks for your help.
> Unfortunately the JDBC driver must pass timestamp parameters without 
> type data and let the server infer the correct type to use 
"server infer the correct type to use",is there any rule?
I change the function name,then ok.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-10-29 03:29 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-28 18:56 about function overload,a bug? cncinfo@126.com <cncinfo@126.com>
2007-10-28 20:44 ` Oliver Jowett <oliver@opencloud.com>
2007-10-29 03:29   ` cncinfo@126.com <cncinfo@126.com>

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