Skip to content
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

Missing LEFT JOIN in DELETE #255

Open
TonnyJe opened this issue Apr 26, 2020 · 0 comments
Open

Missing LEFT JOIN in DELETE #255

TonnyJe opened this issue Apr 26, 2020 · 0 comments

Comments

@TonnyJe
Copy link

TonnyJe commented Apr 26, 2020

Version: ^3.0

Bug Description

Wrong SQL generation for joining tables with DELETE.

Steps To Reproduce

This code

$this->database->table('is_document_item')
                ->where('document.code', 202750006)
                ->where('amount', 0)
                ->fetchAll();

generates this query:

SELECT `is_document_item`.`id` 
FROM `is_document_item` 
LEFT JOIN `is_prijemka_vydejka` `document` ON `is_document_item`.`document_id` = `document`.`id` 
WHERE (`document`.`code` = 202750006) AND (`amount` = 0)

which is exactly what is expected.

But if I change ->fetchAll() to ->delete() so its generate this:

DELETE 
FROM `is_document_item` 
WHERE (`document`.`code` = 202750006) AND (`amount` = 0)

which causes this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'document.code' in 'where clause'

Expected Behavior

I think that is clear.

@dg dg changed the title Wrong compatibility with MariaDB and PHP7.4 Missing LEFT JOIN in DELETE Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant