Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes
Date: 2002-08-19 16:32:02
Message-ID: 3D611D82.30100@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Tom Lane wrote:
> Oh really? Yeah, I'm surprised too (and not happy). Let's definitely
> see that test case...

Here is a test case. Prior to running the following two sessions, I did
the following:

/etc/init.d/postgresql stop
rm -rf pgsql
cvsup to resync with cvs
cvs co pgsql
cd pgsql
./configure --enable-integer-datetimes --enable-locale --enable-debug
--enable-cassert --enable-multibyte --enable-syslog --enable-nls
--enable-depend
make all
make install
initdb
/etc/init.d/postgresql start

Note this this is without any attempt to fix the TEXTOID assertion in
patternsel() -- this is unaltered cvs tip. The two sequntial psql
sessions are below.

Thanks,

Joe

First session:
==============
[root(at)jec-linux-1 pgsql]# psql -U postgres test
Welcome to psql 7.3devel, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

test=# ------------------------------------------------------
test=# -- Session 1:
test=# ------------------------------------------------------
test=# drop table foobytea;
DROP TABLE
test=# create table foobytea(f1 bytea);
CREATE TABLE
test=# insert into foobytea values('crash');
INSERT 698676 1
test=# create index foobytea_idx on foobytea(f1);
CREATE INDEX
test=# set enable_seqscan = off;
SET
test=# select f1 from foobytea where f1 = 'crash';
f1
-------
crash
(1 row)

test=# explain select f1 from foobytea where f1 like 'cr%';
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
test=# \q

Immediately followed by second session:
=======================================
[root(at)jec-linux-1 pgsql]# psql -U postgres test
Welcome to psql 7.3devel, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

test=# ------------------------------------------------------
test=# -- Session 2:
test=# ------------------------------------------------------
test=# set enable_seqscan = off;
SET
test=# explain select f1 from foobytea where f1 = 'crash';
QUERY PLAN
------------------------------------------------------------------------------
Index Scan using foobytea_idx on foobytea (cost=0.00..4.68 rows=1
width=32)
Index Cond: (f1 = 'crash'::bytea)
(2 rows)

test=# select f1 from foobytea where f1 = 'crash';
ERROR: Index foobytea_idx is not a btree
test=# drop index foobytea_idx;
DROP INDEX
test=# create index foobytea_idx on foobytea(f1);
CREATE INDEX
test=# explain select f1 from foobytea where f1 = 'crash';
QUERY PLAN
------------------------------------------------------------------------------
Index Scan using foobytea_idx on foobytea (cost=0.00..4.68 rows=1
width=32)
Index Cond: (f1 = 'crash'::bytea)
(2 rows)

test=# select f1 from foobytea where f1 = 'crash';
f1
-------
crash
(1 row)

test=#

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2002-08-19 16:33:09 Re: contrib/cube
Previous Message Joe Conway 2002-08-19 15:59:55 Re: Success: Finished porting application to postgreSQL

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-08-19 18:29:56 Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes
Previous Message Tom Lane 2002-08-19 15:21:53 Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes