Обсуждение: problem with bool array

Поиск
Список
Период
Сортировка

problem with bool array

От
"Evgeny O. Oleynikov"
Дата:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name               : Evgeny Oleynikov
Your email address      : evg@atom.krasnet.ru

System Configuration
---------------------
  Architecture (example: Intel Pentium)         : Intel Pentium

  Operating System (example: Linux 2.0.26 ELF)  : FreeBSD 2.2.5-RELEASE
a.out

  PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.4.2

  Compiler used (example: gcc 2.8.0)            : gcc 2.7.2.1

Please enter a FULL description of your problem:
------------------------------------------------
'bool' array return type 'char'

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

$ psql template1
Welcome to the POSTGRESQL interactive sql monitor:
  Please read the file COPYRIGHT for copyright terms of POSTGRESQL

   type \? for help on slash commands
   type \q to quit
   type \g or terminate with semicolon to execute query
 You are currently connected to the database: template1

template1=> create table a (wdays bool[]);
CREATE
template1=> insert into a values ('{1,1,1,1,1,1,1}');
INSERT 27977 1
template1=> select * from a where
a.wdays[int4(date_part('dow','now'::datetime))];
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally before or
while processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.
$

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
use:
a.wdays[int4(date_part('dow','now'::datetime))='t'

Re: [BUGS] problem with bool array

От
Bruce Momjian
Дата:
> $ psql template1
> Welcome to the POSTGRESQL interactive sql monitor:
>   Please read the file COPYRIGHT for copyright terms of POSTGRESQL
>
>    type \? for help on slash commands
>    type \q to quit
>    type \g or terminate with semicolon to execute query
>  You are currently connected to the database: template1
>
> template1=> create table a (wdays bool[]);
> CREATE
> template1=> insert into a values ('{1,1,1,1,1,1,1}');
> INSERT 27977 1
> template1=> select * from a where
> a.wdays[int4(date_part('dow','now'::datetime))];
> pqReadData() -- backend closed the channel unexpectedly.
>         This probably means the backend terminated abnormally before or
> while processing the request.
> We have lost the connection to the backend, so further processing is
> impossible.  Terminating.

In current tree, it worked.  You may want to try 6.5.3:

test=> create table a (wdays bool[]);
CREATE
test=> insert into a values ('{1,1,1,1,1,1,1}');
INSERT 18889 1
test=>  select * from a where
tetime))];test-> a.wdays[int4(date_part('dow','now'::datetime))];
      wdays
-----------------
 {t,t,t,t,t,t,t}
(1 row)

test=>

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026