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

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes
Дата
Msg-id 3D611D82.30100@joeconway.com
обсуждение исходный текст
Ответ на bytea operator bugs (was Re: [GENERAL] BYTEA, indexes and "like")  (Joe Conway <mail@joeconway.com>)
Список 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@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@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=#




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes
Следующее
От: Joe Conway
Дата:
Сообщение: Re: bytea operator bugs (was Re: [GENERAL] BYTEA, indexes