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

Bug: multi-column WHERE not prefixed #2532

Closed
MGatner opened this issue Feb 7, 2020 · 2 comments
Closed

Bug: multi-column WHERE not prefixed #2532

MGatner opened this issue Feb 7, 2020 · 2 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@MGatner
Copy link
Member

MGatner commented Feb 7, 2020

Describe the bug
When referencing a fully-qualified column as the target of a WHERE operator the second table name is not prefixed.

CodeIgniter 4 version
Latest develop

Affected module(s)
Builder (tested with MySQLi)

Expected behavior, and steps to reproduce if appropriate

$config['DBPrefix'] = 'foo_';
...
$builder = db_connect()->table('mytable');
$builder->where('mytable.created_at < mytable.updated_at')->get()->getResult();

The above will thrown an exception "Table not found: mytable" because the generated query looks like:
SELECT * FROM foo_mytable WHERE foo_mytable.created_at < mytable.updated_at

(Notice the missing prefix on the latter table reference)

Context

  • OS: Ubuntu 18.04
  • Web server: Apache
  • PHP version: 7.3
@MGatner MGatner added the bug Verified issues on the current code behavior or pull requests that will fix them label Feb 7, 2020
@musmanikram
Copy link
Contributor

@MGatner Please close this bug

@MGatner
Copy link
Member Author

MGatner commented Feb 9, 2020

Oh yeah thanks for the reminder.

@MGatner MGatner closed this as completed Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants