New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_relation with brackets is causing ambiguous column name when the field name exists at the basic table #420

Closed
scoumbourdis opened this Issue Aug 9, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@scoumbourdis
Copy link
Owner

scoumbourdis commented Aug 9, 2017

Example of the issue:

Table 1:
customers

  • id
  • name
  • ref_id

Table 2:
customers_referrence

  • id
  • name
  • country

If we have the below code:

$crud->set_relation('ref_id', 'customers_referrence', '{name} {country}');

Usually this will work but as the field name is ambiguous, the above will not work and it will throw an error:

Error Number: 1052
Column 'name' in where clause is ambiguous

This is only caused by the brackets. So for example the below code:

$crud->set_relation('ref_id', 'customers_referrence', 'name'); //no brackets at the name

will work as expected without getting any error

Thanks
Johnny

@scoumbourdis

This comment has been minimized.

Copy link
Owner

scoumbourdis commented Aug 9, 2017

Problem is now solved and the issue doesn't occur anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment