Repository navigation
Report ambiguous using column MySQL error - #808
Merged
Merged
Conversation
Contributor
Author
|
Looks like the static analysis errors are unrelated to this PR. I couldn't remember if I'm supposed to update the cache files, so please let me know if I should remove them. Thank you! |
hemberger
added a commit
to smrealms/smr
that referenced
this pull request
Oct 9, 2026
When we changed to unique player_id values, the game_id column became a redundancy kept only for convenience. Some queries were relying on game_id being unique after a JOIN, which we had removed since player_id was providing that uniqueness conceptually. However, this was not a concept that was constrained at the MySQL level, so we need to restore uniqueness for game_id by including it in the USING columns of the JOIN. Alternatively, we could remove these convenience game_id columns, but I would prefer to keep them around for now at least. This error will be identified by phpstan-dba if the following PR is merged: staabm/phpstan-dba#808
This error occurs when the query reflector simulates a query that refers to columns by ambiguous names, usually due to a JOIN where both tables have the same column name that isn't part of the join condition. MySQL reports this as error code 1052, and PDO-MySQL reports it as error code 23000. Previously, no error would be emitted, which silently suppressed this class of MySQL errors.
staabm
force-pushed
the
ambiguous-using-column
branch
from
October 10, 2026 06:30
c61b140 to
52fc573
Compare
Owner
|
awesome, thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This error occurs when the query reflector simulates a query that refers to columns by ambiguous names, usually due to a JOIN where both tables have the same column name that isn't part of the join condition.
MySQL reports this as error code 1052, and PDO-MySQL reports it as error code 23000.
Previously, no error would be emitted, which silently suppressed this class of MySQL errors.