Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(metastore): make builtin schemas readonly #2617

Merged
merged 13 commits into from
Feb 13, 2024
Merged

Conversation

greyscaled
Copy link
Contributor

@greyscaled greyscaled commented Feb 9, 2024

Summary

This adds a restriction in metastore for creating entries on builtin schemas, other than the default schema (public).

Details

Initially, this added a builtin schema glare_uploads (#2614), but we later decided to remove it and instead use a table funcition.
At the time, glare_uploads was chosen because prefixing internal schemas with glare_ reduces collision chance, and is what pg does.

Read more on pg_

From https://www.postgresql.org/docs/current/ddl-schemas.html

Since system table names begin with pg_, it is best to avoid such names to ensure that you won't suffer a conflict if some future version defines a system table named the same as your table. (With the default search path, an unqualified reference to your table name would then be resolved as the system table instead.) System tables will continue to follow the convention of having names beginning with pg_, so that they will not conflict with unqualified user-table names so long as users avoid the pg_ prefix.

Progress

  • Add glare_uploads schema
  • Make schema read-only
  • Add test(s)

The user_files schema is intended to be a well-known schema for
accessing files uploaded in cloud.
@greyscaled greyscaled self-assigned this Feb 9, 2024
@greyscaled greyscaled changed the title [WIP] feat(sqlbuiltins): user_files schema [WIP] feat(sqlbuiltins): glare_uploads schema Feb 9, 2024
@greyscaled greyscaled marked this pull request as ready for review February 9, 2024 17:16
@greyscaled greyscaled changed the title [WIP] feat(sqlbuiltins): glare_uploads schema feat(sqlbuiltins): glare_uploads schema; disallow entries on builtin schemas Feb 9, 2024
@greyscaled greyscaled changed the title feat(sqlbuiltins): glare_uploads schema; disallow entries on builtin schemas feat(epic#2614): add readonly glare_uploads schema Feb 9, 2024
@greyscaled greyscaled changed the title feat(epic#2614): add readonly glare_uploads schema feat(epic#2614): readonly glare_uploads schema Feb 9, 2024
Copy link
Collaborator

@tychoish tychoish left a comment

Choose a reason for hiding this comment

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

I'm ok with this but @scsmithr or @vrongmeal should give it the once over.

@greyscaled greyscaled changed the title feat(epic#2614): readonly glare_uploads schema feat(epic#2614): make builtin schemas readonly Feb 13, 2024
@greyscaled greyscaled changed the title feat(epic#2614): make builtin schemas readonly fix: make builtin schemas readonly Feb 13, 2024
@greyscaled greyscaled changed the title fix: make builtin schemas readonly fix(metastore): make builtin schemas readonly Feb 13, 2024
@greyscaled
Copy link
Contributor Author

I'm ok with this but @scsmithr or @vrongmeal should give it the once over.

sounds good, added them as reviewers.

I've also updated the code since your last review to remove the glare_uploads schema, as we decided to use a table func.

@greyscaled greyscaled merged commit d67fe3d into main Feb 13, 2024
22 checks passed
@greyscaled greyscaled deleted the grey/upload-schema branch February 13, 2024 17:39
tychoish pushed a commit that referenced this pull request Feb 15, 2024
This adds a restriction in metastore for creating entries on builtin schemas, other than the default schema (`public`).
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.

None yet

3 participants