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: [QueryBuilder] Invalid INSERT query when builder use table alias #5365

Closed
pawelkg opened this issue Nov 21, 2021 · 0 comments · Fixed by #5376
Closed

Bug: [QueryBuilder] Invalid INSERT query when builder use table alias #5365

pawelkg opened this issue Nov 21, 2021 · 0 comments · Fixed by #5376
Assignees
Labels
bug Verified issues on the current code behavior or pull requests that will fix them database Issues or pull requests that affect the database layer

Comments

@pawelkg
Copy link
Contributor

pawelkg commented Nov 21, 2021

PHP Version

8.0

CodeIgniter4 Version

4,1,5

CodeIgniter4 Installation Method

Composer (as dependency to an existing project)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

MariaDB 10.1.31

What happened?

I get builder in my Model (I do not extend CodeIgniter Model) assigned to property like that:
$this->builder = $this->dbConn->table($this->getTable() . ' as t');
getTable() return set table name.
When I produce queries for in eg. select, they are produced nicely.
When I want to produce insert query, builder use table alias I provided and produce query like this:

INSERT INTO `users` as `t` (fields) VALUES (values)

Steps to Reproduce

Create builder object with passed table alias and try to produce insert query.

Expected Output

INSERT INTO `users` (fields) VALUES (values)

Anything else?

I do not extend CodeIgniter Model.

@pawelkg pawelkg added the bug Verified issues on the current code behavior or pull requests that will fix them label Nov 21, 2021
@kenjis kenjis added the database Issues or pull requests that affect the database layer label Nov 21, 2021
@kenjis kenjis changed the title Bug: Invalid insert query when builder use table alias Bug: Invalid INSERT query when builder use table alias Nov 21, 2021
@kenjis kenjis self-assigned this Nov 23, 2021
@kenjis kenjis changed the title Bug: Invalid INSERT query when builder use table alias Bug: [QueryBuilder] Invalid INSERT query when builder use table alias Apr 2, 2022
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 database Issues or pull requests that affect the database layer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants