RE: [SQL] Is this BUG or FEATURE?

Taral <taral@mail.utexas.edu>

From: "Taral" <taral@mail.utexas.edu>
To: <doka@root.webest.com>, "PgSQL-sql" <pgsql-sql@postgreSQL.org>
Cc: <pgsql-hackers@postgreSQL.org>
Date: 1998-10-17T17:44:33Z
Lists: pgsql-hackers, pgsql-sql
> 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!

Yes it has. ata = 0 in both because you set a default.

> 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)

You asked for all cases where bnum = ata. I assume select * from aaa,bbb;
would have returned:

anum|           aname|ata|bnum|           bname
----+----------------+---+----+----------------
   0|0               |  0|   0|0
   0|0               |  0|   1|1
   1|1               |  0|   0|0
   1|1               |  0|   1|1

Now filter for bnum=ata and you get two rows.

Am I wrong here?

Taral