Skip to content

Detect schema without tables in schema_exists#30

Merged
marcusmunch merged 4 commits intomainfrom
register-empty-schema
Sep 7, 2023
Merged

Detect schema without tables in schema_exists#30
marcusmunch merged 4 commits intomainfrom
register-empty-schema

Conversation

@marcusmunch
Copy link
Copy Markdown
Contributor

Turns out one of the issues I had regarding setting up GitHub actions was that schema_exists would always return FALSE unless a table existed in the schema.

This is now fixed by trying to create a table (and immediately deleting it) if no tables were found within the schema. This does mean that the function will always return FALSE on a schema with no tables if the user does not have CREATE TABLE privileges.

A more hands-off, backend-specific (i.e. PostgreSQL-specific) solution could be made, but I opted for a potentially wider usable method.

@marcusmunch marcusmunch added the bug Something isn't working label Sep 7, 2023
@marcusmunch marcusmunch self-assigned this Sep 7, 2023
@marcusmunch marcusmunch marked this pull request as ready for review September 7, 2023 11:17
Copy link
Copy Markdown
Contributor

@RasmusSkytte RasmusSkytte left a comment

Choose a reason for hiding this comment

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

Approved with a single suggestion

@marcusmunch marcusmunch merged commit fbc62bd into main Sep 7, 2023
@marcusmunch marcusmunch deleted the register-empty-schema branch September 7, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants