Skip to content

Commit

Permalink
Remove schema/table name from the update columns key
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ajmweb authored Nov 4, 2021
1 parent 744fcda commit 3c6db37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Cockroach/Grammar/Query/CockroachGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected function compileUpdateColumns(Builder $query, array $values)
// columns and convert it to a parameter value. Then we will concatenate a
// list of the columns that can be added into this update query clauses.
return collect($values)->map(function ($value, $key) {
return $this->wrap($key).' = '.$this->parameter($value);
return $this->wrap(end(explode('.', $key))).' = '.$this->parameter($value);
})->implode(', ');
}

Expand Down

0 comments on commit 3c6db37

Please sign in to comment.