- Notifications
You must be signed in to change notification settings - Fork67
Closed
Description
Schema and data:
createtableparent ( idSERIALNOT NULL, owner_idINTEGERNOT NULL);createtablechild ( parent_idINTEGERNOT NULL, owner_idINTEGERNOT NULL);createtablechild_nopart ( parent_idINTEGERNOT NULL, owner_idINTEGERNOT NULL);insert into parent (owner_id)values (1), (2), (3), (3);insert into child (parent_id, owner_id)values (1,1), (2,2), (3,3), (5,3);insert into child_nopart (parent_id, owner_id)values (1,1), (2,2), (3,3), (5,3);select create_hash_partitions('child','owner_id',2);
The select SQL to reproduce:
select*from parentleft join childonchild.parent_id=parent.idandchild.owner_id=parent.owner_idwhereparent.owner_id=3andparent.idin (3,4);
Actual result:
idowner_idparent_idowner_id3333335343334353
https://explain.depesz.com/s/ioD5K
All of this will work as expected:
select*from parentleft join childonchild.parent_id=parent.idandchild.owner_id=3whereparent.owner_id=3andparent.idin (3,4);select*from parentleft join child_1 childonchild.parent_id=parent.idandchild.owner_id=parent.owner_idwhereparent.owner_id=3andparent.idin (3,4);select*from parentleft join child_nopart childonchild.parent_id=parent.idandchild.owner_id=parent.owner_idwhereparent.owner_id=3andparent.idin (3,4);select*from parentleft join childonchild.parent_id=parent.idandchild.owner_id=parent.owner_idwhereparent.owner_id=3;
Result:
idowner_idparent_idowner_id333343<null><null>
Affected version 1.3.2