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
Using soft deletes can lead to mysql ambiguous exception #1881
Comments
Can you provide the CodeIgniter code which generates this query? |
@lonnieezell and @jim-parry, I have done some analysis on the code of pagination and db drivers. Found, paginate works with single model only, so there wont be chances of having join there. If we use $this->db->join, we can directly state the table name with column name to avoid ambiguous column issue. |
@atishamte I don't think that's quite true about not having issues with paginate. If you would do a join with another table that has a Should be as simple as adding the table to the deletedField during the constructor, but I think we might run into issues with binding. |
Using soft deletes should not return an ambiguous field message when joining tables. Closes #1881
If two tables use soft deletes and you join them together the deleted field becomes ambiguous.
For example (I believe this query is created for pagination):
SELECT COUNT(*) AS
numrows
FROM
recipient
INNER JOIN
location
ONrecipient
.location_id
=location
.id
WHERE
location
.business_id
= 3AND
deleted
= 0deleted should be recipient.deleted to correct the issue.
version: beta1
The text was updated successfully, but these errors were encountered: