Skip to content

Introduce QualifiedName (fixes #228)#257

Merged
shane-circuithub merged 1 commit intomasterfrom
QualifiedName
Jul 11, 2023
Merged

Introduce QualifiedName (fixes #228)#257
shane-circuithub merged 1 commit intomasterfrom
QualifiedName

Conversation

@shane-circuithub
Copy link
Copy Markdown
Contributor

This adds a new type QualifiedName for named PostgreSQL objects (tables, views, functions and sequences) that can optionally be qualified by a schema. Previously only TableSchema could be qualified in this way.

QualifiedName has an IsString instance so the common case (where the schema is Nothing) doesn't have to care about schemas (if OverloadedStrings is enabled).

This also refactors TableSchema to use QualifiedName for its name field and drops its schema field.

Thanks to @elldritch for the bug report and the inspiration.

@shane-circuithub shane-circuithub requested a review from ocharles July 8, 2023 14:38
@shane-circuithub shane-circuithub force-pushed the QualifiedName branch 3 times, most recently from daa9b71 to 01b7e9d Compare July 8, 2023 14:53
Copy link
Copy Markdown
Contributor

@ocharles ocharles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Could you also add a changelog fragment? Maybe temporarily switch to #255, run scriv create --edit and then commit it back on this branch.

@shane-circuithub shane-circuithub force-pushed the QualifiedName branch 2 times, most recently from 5853189 to c0e44bd Compare July 11, 2023 12:02
This adds a new type `QualifiedName` for named PostgreSQL objects (tables, views, functions and sequences) that can optionally be qualified by a schema. Previously only `TableSchema` could be qualified in this way.

`QualifiedName` has an `IsString` instance so the common case (where the schema is `Nothing`) doesn't have to care about schemas (if `OverloadedStrings` is enabled).

This also refactors `TableSchema` to use `QualifiedName` for its `name` field and drops its `schema` field.

Thanks to @elldritch for the bug report and the inspiration.
@shane-circuithub shane-circuithub enabled auto-merge (squash) July 11, 2023 12:05
@shane-circuithub shane-circuithub merged commit c778ac1 into master Jul 11, 2023
@shane-circuithub shane-circuithub deleted the QualifiedName branch July 11, 2023 12:06
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

Successfully merging this pull request may close these issues.

3 participants