[BUGS] BUG #14494: Regression - Null arrays are not queryable

Поиск
Список
Период
Сортировка
От linasvepstas@gmail.com
Тема [BUGS] BUG #14494: Regression - Null arrays are not queryable
Дата
Msg-id 20170113183824.24286.84705@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: [BUGS] BUG #14494: Regression - Null arrays are not queryable  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [BUGS] BUG #14494: Regression - Null arrays are not queryable  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14494
Logged by:          Linas Vepstas
Email address:      linasvepstas@gmail.com
PostgreSQL version: 9.6.1
Operating system:   Debian unstable
Description:

Array handling appears to have regressed,
with lots of surprising results for empty
and null arrays.

CREATE TABLE foo (
  name    TEXT,
  outgoing BIGINT[] 
);

INSERT INTO FOO VALUES ('one', '{43, 67}');
INSERT INTO FOO VALUES ('two', '{}');
INSERT INTO FOO VALUES ('three', null);

test=> select * from foo;
 name  | outgoing 
-------+----------
 one   | {43,67}
 two   | {}
 three | 
(3 rows)

very good!

test=> select * from foo where outgoing='{}';
 name | outgoing 
------+----------
 two  | {}
(1 row)

very good!

test=> select * from foo where outgoing=null;
 name | outgoing 
------+----------
(0 rows)

unexpected: wanted one row here.

test=> select * from foo where outgoing != '{43,67}';
 name | outgoing 
------+----------
 two  | {}
(1 row)

unexpected: wanted two rows here. Where did the null row go?
test=> select * from foo where array_length(outgoing,1)=2 ;
 name | outgoing 
------+----------
 one  | {43,67}
(1 row)

very good

test=> select * from foo where array_length(outgoing,1)=0 ;
 name | outgoing 
------+----------
(0 rows)

Huh? there is at least one array whose length is zero, and another that
doesn't have a length...



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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jonathon Nelson
Дата:
Сообщение: Re: [BUGS] Bug in Physical Replication Slots (at least 9.5)?
Следующее
От: jorge castañeda
Дата:
Сообщение: Re: [BUGS] BUG #14492: Foreign Table import from SQL Server 2005