catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

v1.7 breaks LEFT JOIN on Postgres #849

Closed CydeSwype closed 5 years ago

CydeSwype commented 5 years ago

Describe the bug Left join doesn't work. Note the ON ."network_merchant_id" below in the broken SQL output.

Information

Detail Code This PHP code:

$result = $db->select("table_name", [
    "[>]network_merchant" => ["network_merchant_id" => "id"],
], [
    "table_name.id",
    "table_name.network_id",
], [
    "ORDER" => ["table_name.id" => "ASC"]
]);

Actual output produces the following broken output (from 1.7):

SELECT 
    "table_name"."id",
    "table_name"."network_id",
    "table_name"."network_merchant_id",
FROM "table_name" LEFT JOIN "network_merchant" ON ."network_merchant_id" = "network_merchant"."id" 
ORDER BY "table_name"."id" ASC

Expected output but used to produce this correct output (from v1.6.1):

SELECT 
    "table_name"."id",
    "table_name"."network_id",
    "table_name"."network_merchant_id",
FROM "table_name" LEFT JOIN "network_merchant" ON "table_name"."network_merchant_id" = "network_merchant"."id" 
ORDER BY "table_name"."id" ASC
catfan commented 5 years ago

Thank, this fixed on b2d8327f5fe800b9646f683dfc7a1d6b496a370f in emergency.