Issue #6 resolved

htsql follows foreign keys overzealously

Leo Shklovskii
created an issue

Discussed with rz in irc:

postgres 8.4, I've got an FK that links to another FK. so, A->B->C where the field that A FK's to is the FK to C as well doing A.B_id actually queries C

[5:14] rz: well, you have A.B_id referring to B.id and B.id refers to C.id?

[5:16] rz: or is it a multi-key FK?

[5:16] LeoSh: B doesn't have an id column of its own, so A.B_id refers to B.c_id which refers to C.id

[5:16] LeoSh: nope, not multi-key

[5:16] rz: yeah, got it

It's really unexpected behavior, although there is a workaround of simply doing A.B as long as that's not an ambiguous reference.

rz explained that this has to do with multifield fk's, and while I understand that, it seems like that's more of an exception case.