Problem description:

I have two tables with the column 'machine_name', joined together. Ctools adds a condition on this key name, but without specifying the table. Here's the full error.

Exception thrown

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'machine_name' in where clause is ambiguous: SELECT t__0.*, t__1.* FROM {base_table} t__0 INNER JOIN {joined_table} t__1 ON t__0.machine_name = t__1.machine_name WHERE (machine_name IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => the_name ) in ctools_export_load_object() (line 462 of sites/all/modules/contrib/ctools/includes/export.inc).

Additional problem

The documentation talks about 'key in table', which is not used anywhere in the code. I believe this should be THE place to use it.

Proposed solution:

Prepend the column name in the WHERE clause with the table specified in 'key in table', or the table the export is defined in.

Comments

Stevel created an issue. See original summary.

Stevel’s picture

Assigned: Stevel » Unassigned

Unassigning myself for feedback about the proposed solution.