Bug in 6.4 release

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: PostgreSQL-development <hackers(at)postgreSQL(dot)org>
Subject: Bug in 6.4 release
Date: 1998-11-18 19:26:40
Message-ID: 36531F70.69E2DD9C@trust.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I have the following problem using PostgreSQL 6.4 on RedHat Linux 5.1
on x86

using the following table

thplus=> \d envelope

Table = envelope
+-------------------------+----------------------------------+-------+
| Field | Type | Length|
+-------------------------+----------------------------------+-------+
| envelope_id | int4 not null default nextval ( | 4 |
| order_type_id | int4 not null | 4 |
| envelope_name | varchar() not null | 32 |
| signed_string | text | var |
| envelope_comment | text | var |
| envelope_on_hold | int2 | 2 |
| envelope_order_count | int4 | 4 |
| envelope_total | int4 | 4 |
| envelope_currency | text | var |
| envelope_modify_time | datetime | 8 |
| state_id | char() | 1 |
+-------------------------+----------------------------------+-------+

thplus=> create index envelope_fk2 on envelope(state_id)

I try to use the following query

thplus=>
explain
thplus-> select count(*) from envelope where state_id='H' or
state_id='E';
NOTICE: QUERY PLAN:

Aggregate (cost=4.10 size=0 width=0)
-> Index Scan using envelope_fk2 on envelope (cost=4.10 size=1
width=4)

EXPLAIN

when actually running it, I get the following:

thplus=> select count(*) from envelope where state_id='H' or
state_id='E';
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.

But the following query runs fine:

thplu=> select count(*) from envelope where envelope_id=1 or
envelope_id=3;
count
-----
2
(1 row)

as well as this

thplus=> select count(*) from envelope where envelope_id=1 or
state_id='E';
count
-----
12
(1 row)

and this

thplus=> select count(*) from envelope where state_id='H'
thplus-> union
thplus-> select count(*) from envelope where state_id='E';
count
-----
11
1140
(2 rows)

So it seems that there is a problem with using indexes in ORs that are
defined over text types

the same crash happened also when using varchar(1) as the type of
state_id

BTW, it does not happen when the state_id is first field

--------------
Hannu

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-11-18 19:56:22 Re: [HACKERS] Bug in 6.4 release
Previous Message Pedro J. Lobo 1998-11-18 18:08:26 More on 6.4 on DEC Alpha + Digital Unix 4.0d + DEC C compiler