pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fernando Nasser <fnasser@redhat.com>
To: Dmitry Tkach <dmitry@openratings.com>
Cc: Barry Lind <blind@xythos.com>
Cc: wsheldah@lexmark.com
Cc: pgsql-jdbc @ postgresql . org <pgsql-jdbc@postgresql.org>
Subject: Re: Prepared Statements
Date: Fri, 18 Jul 2003 11:20:52 -0400
Message-ID: <3F181054.5080707@redhat.com> (raw)
References: <OFBD7C18F4.2499D62A-ON85256D66.005245AA@lexmark.com>
	<3F174BFF.3070704@xythos.com>
	<3F1801C5.9030104@openratings.com>
	<3F18065A.1060406@redhat.com>
	<3F180FB2.3090408@openratings.com>

Dmitry Tkach wrote:
> Fernando Nasser wrote:
> 
>>>
>>
>> I don't believe this is actually being sent to the backend, maybe it 
>> is just a toString() bug.
> 
> 
> You better do believe it. I tried it, and it works. :-)
> 
>>
>> The backend should get:
>>
>> select * from user where id='null;drop database mydb'
>>
>> (If it does not it is a bug.) 
> 
> 
> Nah... That's what it would get if you did setString()... setObject () 
> doesn't work that way.
> I tend to agree, it's a bug - if the type is INTEGER, it should be 
> checking if the object, passed in is really numeric.
> 
> The thing is that, at least, in the current state of the driver, this is 
> a *really nice* bug, that gives you the only way to use certain 
> functionality....
> For example:
> 
> PreparedStatement stmt = c.prepareStatement ("select * from mytable 
> where data in ?");
> stmt.setObject (1, "(1,2,3,4,5)", Types.INTEGER);
> 
> ... if the "bug" was fixed, there would be no other way to do this kind 
> of thing :-(
> 

Well, I guess the bug will have be fixed asap as it is a security risk.

What is the proper JDBC way for filling IN lists in prepared statements?

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9




view thread (105+ messages)  latest in thread

Message-ID: <3F181054.5080707@redhat.com>
Permalink:  ../3F181054.5080707@redhat.com/
Also on:    postgresql.org/message-id/3F181054.5080707@redhat.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: fnasser@redhat.com, dmitry@openratings.com, blind@xythos.com, wsheldah@lexmark.com
  Subject: Re: Prepared Statements
  In-Reply-To: <3F181054.5080707@redhat.com>
  References: <OFBD7C18F4.2499D62A-ON85256D66.005245AA@lexmark.com> <3F174BFF.3070704@xythos.com> <3F1801C5.9030104@openratings.com> <3F18065A.1060406@redhat.com> <3F180FB2.3090408@openratings.com> <3F181054.5080707@redhat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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