Grokbase
x

Re: the IN clause saga

View PostFlat  Thread  Threaded | < Prev - Next >
Dmitry Tkach Re: the IN clause saga
| +1 vote
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
Fernando Nasser wrote:

> Thanks for summarizing it Oliver.
>
> I've asked Tom Lane about the backend behavior and he informed me that:
>
> 1) 7.4 backends do support parameters in the IN predicate, as ($1, $2,
> $3) (i.e., our (?, ?, ?) syntax).
>
> 2) 7.4 backends have a PostgreSQL specific extension that allows you
> to fill the IN predicate with a list: ($1) (i.e., our (?) ). One has
> to pass a PostgreSQL array, like integer[] to fill the list. Note
> that the parenthesis is already in place, it is not generated by the ?
> expansion.

If I read this correctly, there is no need for any special handling
from  the driver side - just setArray() should work. Or am I missing 
something?

Dima

Thread : the IN clause saga
1)
Oliver Jowett Some of the threads on this are getting a bit bogged down, I thought I'd summarize the viable...
2)
Felipe Schnack I also prefer number one. Maybe we should do a poll? :-) > (send "unregister YourEmailAddressHere"...
3)
Fernando Nasser Oliver has to update his summary first. There are some new info from the backend side. Note that...
4)
Fernando Nasser Thanks for summarizing it Oliver. I've asked Tom Lane about the backend behavior and he informed me...
5)
Tom Lane No, it's not the same thing --- the planner can generate an indexscan plan when scalar params are...
6)
Dmitry Tkach it doesn't (at least, not in the current implementation) - Types.OTHER ends up calling setString(),...
7)
Dmitry Tkach It will throw an exception - "Unrecognized parameter type: " + Object.getClass().getName () Well......
8)
Dmitry Tkach This is the same problem, as it generally exists with x=? - the query plan is generally not as good...
9)
Dmitry Tkach Oops :-( I see... that is a world of a differnce :-( Dima ...
10)
Oliver Jowett Ouch. That syntax is going to be messy to transform into an IN clause for <7.4 backends. -O
11)
Fernando Nasser Remember we will already have to know that we are handling the <in values list> clause (i.e. it is...
12)
Dmitry Tkach If I read this correctly, there is no need for any special handling from the driver side - just...
13)
Fernando Nasser With the new V3 protocol this is probably true (7.4 will support V3).
14)
Oliver Jowett Well, certainly, we'd need to change setObject to understand this new type. Good point. Hmm, so...
15)
Oliver Jowett I assume this is only when you're doing a PREPARE/EXECUTE? Hm, then it sounds like the right...
16)
Fernando Nasser yes. That is _exactly_ what I am proposing (option 2 of your summary)...
17)
Barry Lind No you are not. --Barry ...
18)
Fernando Nasser In case you missed my last comment: Mind that this is only necessary for backward compatibility....
19)
Felipe Schnack > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
20)
Fernando Nasser Mind that this is only necessary for backward compatibility. With 7.4 and the V3 protocol you just...
21)
Darin Ohashi I'm not sure if this makes sense, but could you have a conflict between a set containing a single...
22)
Fernando Nasser You will need to have an Array of Arrays in that case.
23)
Joe Conway Sorry for jumping in but it doesn't seem that everyone understands the new functionality Tom...
24)
peter royal not at all. i say the people that need that write their own layer on top of JDBC. -pete
25)
Darin Ohashi Will this requirement violate the SQL standard for PREPARE/EXECUTE? Darin
26)
Fernando Nasser PREPARE is not a Core SQL statement, it is only defined for embedded SQL extension as it can be...
27)
Kris Jurka Perhaps these cases would also be illustrative as I believe that is what Fernando was suggesting....
28)
Joe Conway Right, as I said, this syntax is trying to compare the scalar value to the entire array value, not...
29)
Fernando Nasser OK, I got the message that the parameter can only be used in the set predicates like ANY but not in...
30)
Joe Conway None of what I mentioned had anything specific to do with PREPARE+EXECUTE. Sorry if I caused any...
31)
Kris Jurka The prepare+execute is no different than the select. It's not going to perform any magic for you....
spacer
View PostFlat  Thread  Threaded | < Prev - Next >
Home > Groups > PostgreSQL - JDBC > the IN clause saga (31 posts) > View Post