> 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