Is this BUG or FEATURE?

From: Vladimir Litovka <pgsqll(at)barnet(dot)kharkov(dot)ua>
To: PgSQL-sql <pgsql-sql(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Is this BUG or FEATURE?
Date: 1998-10-17 13:19:15
Message-ID: Pine.LNX.4.03.9810171603380.29982-100000@barnet.kharkov.ua
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Hello!

There is problem - I don't know where is it.

I'm using PostgreSQL 6.3.2 under Linux-2.0 with official patches:

. linux_elf.patch-980421.gz
. gram.c.patch-980428
. configure-980430.gz
. btree_adj-980730.gz

There are two tables in my test database:

create table AAA (anum int2, aname char(16), ata int4 default 0);
insert into AAA values (0, '0');
insert into AAA values (1, '1');
-- Note: ata hasn't initialized!

create table BBB (bnum int2, bname char(16));
insert into BBB values (0, '0');
insert into BBB values (1, '1');

Now try some queries:

test=> select * from aaa, bbb where bnum = anum;
anum| aname|ata|bnum| bname
----+----------------+---+----+----------------
0|0 | 0| 0|0
1|1 | 0| 1|1
(2 rows)

It's OK, in both AAA and BBB all fields as expected.

test=> select * from aaa, bbb where bnum = ata;
NOTICE: ExecInitMergeJoin: left and right sortop's are unequal!
anum| aname|ata|bnum| bname
----+----------------+---+----+----------------
0|0 | 0| 0|0
1|1 | 0| 0|0
(2 rows)

Why bnum and bname are 0 and '0' respectively? I'm agree - ata and bnum
has different types, but why illegal comparison resets BBB's fields? In the
last query I'm expect for one row in result, where bnum == ata == 0!

Who is wrong - I'm or PostgreSQL? And why?

---
Vladimir Litovka <doka(at)webest(dot)com>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter T Mount 1998-10-17 13:51:32 Re: [HACKERS] PostgreSQL grows to enormous size.
Previous Message Paul A Vixie 1998-10-17 04:53:43 Re: hackers-digest V1 #1030

Browse pgsql-sql by date

  From Date Subject
Next Message Taral 1998-10-17 17:44:33 RE: [SQL] Is this BUG or FEATURE?
Previous Message Philippe Rochat (RSR: 318 17 93) 1998-10-16 22:38:26 Re: Triggers and SQL functions