dbTalk Databases Forums  

[BUGS] BUG #2839: after record with NULL field, query result is wrong

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2839: after record with NULL field, query result is wrong in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Vladimir
 
Posts: n/a

Default [BUGS] BUG #2839: after record with NULL field, query result is wrong - 12-19-2006 , 10:03 AM







The following bug has been logged online:

Bug reference: 2839
Logged by: Vladimir
Email address: dvs (AT) fon (DOT) kamchatka.ru
PostgreSQL version: 8.1.3
Operating system: FreeBSD
Description: after record with NULL field, query result is wrong
Details:

create table tst (a int[]);
insert into tst values ('{1}'); -- (1)
insert into tst values (null);
insert into tst values ('{2}'); -- (3)
select z.a from tst z where exists (select 1 from
(
select generate_series(1,1) as s,* from (select z.a as arr0) qq
) q
where (q.arr0[q.s] is null) );
a
-----

{2}
(2 rows)

-- What difference between (1) and (3) records?
-- really, my query more complex (auto generated) and table has many
columns, wrong rows return after row where tested field is null

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2839: after record with NULL field, query result is wrong - 12-26-2006 , 01:31 PM






"Vladimir" <dvs (AT) fon (DOT) kamchatka.ru> writes:
Quote:
create table tst (a int[]);
insert into tst values ('{1}'); -- (1)
insert into tst values (null);
insert into tst values ('{2}'); -- (3)
select z.a from tst z where exists (select 1 from
(
select generate_series(1,1) as s,* from (select z.a as arr0) qq
) q
where (q.arr0[q.s] is null) );
Hmm, surprising this hasn't been found before, because the underlying
bug has been around for a long time :-(. Fix committed --- thanks for
the report!

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.