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

Implement check_function_bodies only for Postgres #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cmer
Copy link

@cmer cmer commented Aug 29, 2023

No description provided.

@cmer
Copy link
Author

cmer commented Aug 29, 2023

Here's a different implementation of #134 . Specs don't pass (not sure why yet), but this is simpler and only for PG.

@cmer
Copy link
Author

cmer commented Aug 29, 2023

Is this implementation more aligned with what you had in mind?

@cmer
Copy link
Author

cmer commented Sep 30, 2024

Any chance this could be merged in? Thanks!

@teoljungberg
Copy link
Owner

I'm unsure I want to support this, because I have no context of the use-case or how it is supported in other databases (and therefore the other adapters).

@cmer
Copy link
Author

cmer commented Nov 8, 2024

From the previous PR:

Added a new configuration parameter check_function_bodies to allow controlling the database behavior when loading functions.

This is necessary if the function created relies on the existence of a table that is not yet created, for example.

Disabling check_function_bodies is pg_dump's default behaviour and, in my opinion, should be Fx's default behavior as well.

As mentioned, this is the default behavior of pg_dump and essential to load a schema that includes functions. Without this, creating a functions that depend on tables that are yet to be created fails (ie: will be created in a subsequent query from the schema).

@teoljungberg
Copy link
Owner

Thanks @cmer - I need to do some reading on this and testing. Can't promise when or if that happens, but I will try.

@cmer
Copy link
Author

cmer commented Nov 10, 2024

Thanks! This would be game-changer TBH. Hope you see the value in it.

# https://www.postgresql.org/docs/9.5/runtime-config-client.html#GUC-CHECK-FUNCTION-BODIES
#
# Set to `nil` to use the database default configuration.
# The default and recommended value is `false` to mimic pg_dump's behavior.

Choose a reason for hiding this comment

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

I am not sure about this. The docs say:

This parameter is normally on.

So maybe the default should be true here, with the possibility to set it to false for specific use cases?

Copy link
Author

Choose a reason for hiding this comment

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

You could do that. It's off by default for pg_dump from what I remember, and this gem is the closest thing to pg_dump so it seemed reasonable to follow the pg_dump conventions. Either way works. Just having the option would be a huge win!

Copy link
Author

Choose a reason for hiding this comment

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

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