framework: [6.0] PostgreSQL incompatibility?
- Laravel Version: 6.0.1
- PHP Version: 7.2.22 / 7.3.9
- Database Driver & Version: PostgreSQL 9.5.18
Description:
There seems to be an issue when using PostgreSQL with Laravel 6.0 with how some columns are being represented in queries. I’ve only been able to check this with 1-1 relationship so far, but from what I can see Laravel 6 is producing a query like:
select * from "user_2fa" where "user_2fa"."user_id" = 1 and ("user_2fa.user_id") is not null limit 1
Note the " (double-quotes) around "user_2fa.user_id". This syntax is trying to find a column with that entire string as its name, instead of table.column as expected.
PostgreSQL would accept: "user_2fa"."user_id" or 'user_2fa.user_id' (using single quotes) instead.
I might be doing something wrong, but this seems to be pretty broken out of the box. Been using the same code on previous versions for over a year.
Steps To Reproduce:
- Connect to a PostgreSQL database
- Create a 1-1 relationship between two models
- Reference the relationship in the code
- See broken query
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (13 by maintainers)
Usermodel:User2famodel:I’ve finally found the issue and it’s not framework related. Another library was overridding the
whereNulland messing up the wrapping of the columns. I’m going to create a PR over there. Sorry for the noise.Who the heck is this @hotmeteor guy?