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

[5.2.33] increment() on a relationship generates invalid SQL for Postgres #13707

Closed
pmatseykanets opened this issue May 25, 2016 · 6 comments
Closed

Comments

@pmatseykanets
Copy link
Contributor

pmatseykanets commented May 25, 2016

After upgrading from 5.2.31 to 5.2.33 noticed that increment() method called on a relationship i.e.

$exchange->tags()->increment('ref_count');

generates an invalid SQL (at least) for Postgres and breaks the app with an error:

Illuminate\Database\QueryException: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "tags" of relation "tags" does not exist
LINE 1: update "tags" set "ref_count" = "ref_count" + 1, "tags"."upd...

5.2.31 produces the following SQL

update "tags" set "ref_count" = "ref_count" + 1, "updated_at" = ?
  from "exchange_tag" 
 where "exchange_tag"."exchange_id" = ? 
   and "tags"."id" = "exchange_tag"."tag_id"

whereas 5.2.33

update "tags" set "ref_count" = "ref_count" + 1, "tags"."updated_at" = ? 
  from "exchange_tag" 
 where "exchange_tag"."exchange_id" = ? 
   and "tags"."id" = "exchange_tag"."tag_id"

See how table name "tags" crawled in for updated_at?

@GrahamCampbell
Copy link
Member

What about in 5.2.32 please?

@pmatseykanets
Copy link
Contributor Author

5.2.32 is OK. The whole test suite is green. So it looks like this bug was introduced in 5.2.33.

@GrahamCampbell
Copy link
Member

Ping @taylorotwell.

@taylorotwell
Copy link
Member

Can you try on latest tag: 5.2.34?

@pmatseykanets
Copy link
Contributor Author

Seems to be working fine in 5.2.34. The test suite is green. Thanks.

@GrahamCampbell
Copy link
Member

Great. ;)

ajmweb added a commit to ajmweb/cockroachdb-laravel that referenced this issue Nov 4, 2021
Using the schema name for a column generates an error within Cockroach:

SQLSTATE[0A000]: Feature not supported: 7 ERROR:  at or near \"table\": syntax error: unimplemented
HINT:  You have attempted to use a feature that is not yet implemented. See: https://go.crdb.dev/issue-v/27792/v21.1

The update column name is automatically generated by eloquent for columns such as timestamps as '"schema"."table"."updated_at", which is invalid for Postgres and Cockroach.

Similar to issues seen in laravel/framework#13707
leenooks pushed a commit to leenooks/cockroachdb-laravel that referenced this issue Jan 1, 2022
Using the schema name for a column generates an error within Cockroach:

SQLSTATE[0A000]: Feature not supported: 7 ERROR:  at or near \"table\": syntax error: unimplemented
HINT:  You have attempted to use a feature that is not yet implemented. See: https://go.crdb.dev/issue-v/27792/v21.1

The update column name is automatically generated by eloquent for columns such as timestamps as '"schema"."table"."updated_at", which is invalid for Postgres and Cockroach.

Similar to issues seen in laravel/framework#13707
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

3 participants