Normalize seq_name in pgSerializer getColumnsInfoQuery #4966
+6 −1
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.
Prevents a failure to match sequences when introspecting non-default schemas by normalzing the
seq_namecolumn.The
seq_name, assigned asidentityNamein the Postgres introspection is treated as though it is an unqualified column name in multiple locations in the code.This leads to several bugs when using a non-default schema, notably, any
pushto a database after the firstpushwill generate a bad change set that attempts to alter the schema, often by trying to drop the sequence which failed these checks.Concretely, given a
pushformy-schema.todo, theseq_namefor anidcolumn returned from the introspection query would be"my-schema".todo_id_seq, whereas a defaultpublic.todotable would return the unqualifiedtodo_id_seq. All of the code is expecting and handling the default case only, for instance, concatenating the schema name with theseq_namegenerating keys likemy-schema."my-schema".todo_id_seqand testing those against sequences that would have the keymy-schema.todo_id_seq.