![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Description: subquery IN returns incorrect results |
#3
| |||
| |||
|
|
=20 The following bug has been logged online: =20 Bug reference: =A0 =A0 =A01629 Logged by: =A0 =A0 =A0 =A0 =A0mike g Email address: =A0 =A0 =A0mike (AT) thegodshalls (DOT) com PostgreSQL version: 8.0 Operating system: =A0 Windows 2000 Description: =A0 =A0 =A0 =A0subquery IN returns incorrect results Details:=20 =20 If I run this query: SELECT distinct CAST(newprogram as varchar(60)) FROM =A0(SELECT t.propnbr,=20 =A0 =A0 =A0CASE WHEN t.propname =3D =A0'A' THEN 'Am' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'B' THEN 'AMm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'C' THEN 'I might vanish' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'D' THEN 'Bem' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'E' THEN 'Cm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'F' THEN 'Clm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'G' THEN 'Com' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'H' THEN 'Dm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'I' THEN 'Er' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'J' THEN 'Err' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'K' THEN 'Em' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'L' THEN 'Fm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'M' THEN 'Fm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'N' THEN 'Gm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'O' THEN 'Hm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'P' THEN 'Dm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'Q' THEN 'Lm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'R' THEN 'Nm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'S' THEN 'Om' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'T' THEN 'Err' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'U' THEN 'Rm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'V' THEN 'Tm' =A0 =A0 =A0 =A0 =A0 WHEN t.propname =3D =A0'W' THEN 'Tm' =A0 =A0 =A0 =A0 =A0 ELSE t.propname =A0 =A0 =A0 END as newprogram =A0 =A0FROM example_data t =A0 =A0INNER JOIN example_data2 b ON t.propco =3D b.propco =A0WHERE =A0upper(b.serviced) =3D 'STATE1' and =A0t.propname =A0in ('A', 'B' |
|
'C', =A0--switch me 'D', =A0-- and switch me 'E', 'F', [snip] |
#4
| |||
| |||
|
|
"mike g" <mike (AT) thegodshalls (DOT) com> writes: Description: subquery IN returns incorrect results It's impossible to investigate this with the amount of information you have provided. Please show a *self contained* example, including any table declarations and test data needed. regards, tom lane |
#5
| |||
| |||
|
|
Unless this is a copy/paste error, you have missed a , in your query. *Which effectively turns it into ('A', 'B''C', 'D' ... Which mean that switching those two will give incorrect results. One will be missing C, and it will be included with B, and the other D for the same reason. 'C', *--switch me 'D', *-- and switch me 'E', 'F', [snip] Regards Russell Smith. ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
![]() |
| Thread Tools | |
| Display Modes | |
| |