pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #8934: value != ANY (uuid[]) AND expr does not work in all cases
3+ messages / 3 participants
[nested] [flat]

* BUG #8934: value != ANY (uuid[]) AND expr does not work in all cases
@ 2014-01-23 09:47  marcusoverheu@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: marcusoverheu@gmail.com @ 2014-01-23 09:47 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      8934
Logged by:          Marcus Overheu
Email address:      marcusoverheu@gmail.com
PostgreSQL version: 9.2.4
Operating system:   ubuntu 12.04.3
Description:        

if you have a table ala.
 create table uuidtest( aint integer, auuid uuid);

 insert into uuidtest VALUES (1, 'ab15ea27-8768-4cbe-a1fb-02a2a949a34d'),
(1, '1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2');

then 
 select * from uuidtest where auuid = ANY
(ARRAY['1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2','ab15ea27-8768-4cbe-a1fb-02a2a949a34d']::uuid[])
and aint = 1;
return 2 result 
which would mean that if using not in 

select * from uuidtest where auuid != ANY
(ARRAY['1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2','ab15ea27-8768-4cbe-a1fb-02a2a949a34d']::uuid[])
and aint = 1;

would return zero, but it stills returns 2 results. 







-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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

* Re: BUG #8934: value != ANY (uuid[]) AND expr does not work in all cases
@ 2014-01-23 17:11  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: marcusoverheu@gmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: Alvaro Herrera @ 2014-01-23 17:11 UTC (permalink / raw)
  To: marcusoverheu@gmail.com; +Cc: pgsql-bugs

marcusoverheu@gmail.com escribió:

>  insert into uuidtest VALUES (1, 'ab15ea27-8768-4cbe-a1fb-02a2a949a34d'),
> (1, '1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2');
> 
> then 
>  select * from uuidtest where auuid = ANY
> (ARRAY['1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2','ab15ea27-8768-4cbe-a1fb-02a2a949a34d']::uuid[])
> and aint = 1;
> return 2 result 
> which would mean that if using not in 
> 
> select * from uuidtest where auuid != ANY
> (ARRAY['1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2','ab15ea27-8768-4cbe-a1fb-02a2a949a34d']::uuid[])
> and aint = 1;

Presumably you want auuid != ALL (array[ .. ]) here.  In the first case,
each value is = to the value that it equals to, so both are returned.
In the second case, each value is != to the other value, so both are
returned too.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



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

* Re: BUG #8934: value != ANY (uuid[]) AND expr does not work in all cases
@ 2014-01-23 19:44  Marcus Overheu <marcusoverheu@gmail.com>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Marcus Overheu @ 2014-01-23 19:44 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-bugs

Yeah i noticed a bit too late, i apologize for not reading the
documentation properly.


2014/1/23 Alvaro Herrera <alvherre@2ndquadrant.com>

> marcusoverheu@gmail.com escribió:
>
> >  insert into uuidtest VALUES (1, 'ab15ea27-8768-4cbe-a1fb-02a2a949a34d'),
> > (1, '1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2');
> >
> > then
> >  select * from uuidtest where auuid = ANY
> >
> (ARRAY['1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2','ab15ea27-8768-4cbe-a1fb-02a2a949a34d']::uuid[])
> > and aint = 1;
> > return 2 result
> > which would mean that if using not in
> >
> > select * from uuidtest where auuid != ANY
> >
> (ARRAY['1c9e9ce5-d4d8-4a14-9eaf-929f27e09ba2','ab15ea27-8768-4cbe-a1fb-02a2a949a34d']::uuid[])
> > and aint = 1;
>
> Presumably you want auuid != ALL (array[ .. ]) here.  In the first case,
> each value is = to the value that it equals to, so both are returned.
> In the second case, each value is != to the other value, so both are
> returned too.
>
> --
> Álvaro Herrera                http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>

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


end of thread, other threads:[~2014-01-23 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23 09:47 BUG #8934: value != ANY (uuid[]) AND expr does not work in all cases marcusoverheu@gmail.com
2014-01-23 17:11 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2014-01-23 19:44   ` Marcus Overheu <marcusoverheu@gmail.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