I have a need to do SQL joins on tables using composite keys, but the current SQL::Abstract::Pg module only supports joining on a single key. This adds support for multiple keys, with the following syntax.
SELECT * FROM "foo" JOIN "bar" ON ("foo"."id" = "bar"."foo_id" AND "foo"."id2" = "bar"."foo_id2")
It's fairly straightforward, but I have one concern worth considering:
The argument to the select (the $source argument) is a reference to an array. In SQL::Abstract, the general convention is "things in arrays are OR'ed, and things in hashes are AND'ed". This PR assumes AND'ing the keys used in the join. It suits my needs, but is this a serious infraction of the SQL::Abstract convention, or does it not need to apply because this is specific to the join condition?
I have a need to do SQL joins on tables using composite keys, but the current SQL::Abstract::Pg module only supports joining on a single key. This adds support for multiple keys, with the following syntax.
to yield
It's fairly straightforward, but I have one concern worth considering:
The argument to the
select
(the$source
argument) is a reference to an array. In SQL::Abstract, the general convention is "things in arrays are OR'ed, and things in hashes are AND'ed". This PR assumes AND'ing the keys used in the join. It suits my needs, but is this a serious infraction of the SQL::Abstract convention, or does it not need to apply because this is specific to the join condition?