Repository navigation
feat: treat public names as unqualified and hide other schemas - #68
Merged
Merged
Conversation
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.
Summary
sqlcj now models exactly one PostgreSQL namespace. Unqualified and
public-qualified table and type names —users,public.users,"public"."users"— are the same name, sopg_dumpsnapshots and migrations that qualify every object withpublic.load into the same model as unqualified ones, while tables and types of any other schema can no longer be silently mistaken for a modeled object of the same unqualified name.Changes
search_pathis not followed.CREATE TABLE,ALTER TABLE,CREATE TYPE, andALTER TYPEwhose own table or type belongs to another schema are ignored before anything they name is resolved, whether the parser can read them or not;DROP TABLEskips such names and still drops modeled tables named beside them.LIKEorPARTITION OFsource of another schema fails asTable not found in schema: <schema>.<t>; anATTACHorDETACH PARTITIONpartition of another schema is ignored.ALTER TABLE ... SET SCHEMA <schema>as the sole action removes the table, does nothing forpublic, and is rejected for a table with modeled partitions or when combined with another action.public-qualified enum names resolve inCREATE TYPE(replacing a modeled enum of that name),ADD VALUE,RENAME VALUE,RENAME TO, column types,ADD COLUMN,ALTER COLUMN ... TYPE, and casts, including arrays written aspublic.mood[]or"public"."mood"[];ALTER TYPE ... SET SCHEMA publicof a modeled enum does nothing, andRENAME TOorSET SCHEMAof an unmodeled type is ignored however it is qualified.FROM,JOIN,INSERT,UPDATE, orDELETEare rejected asTable not found in schema: <schema>.<t>.Scope and non-goals
qualifier.*in queries are not supported.publicpartition attached to a table of another schema,pg_catalog-qualified names, and three-part names are not modeled.DROP TABLEkeeps its existing handling.ALTER TYPE ... SET SCHEMAof a modeled enum to a schema other thanpublicstays rejected.