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

Add sanity checks for ENR entries. #506

Conversation

timchang514
Copy link
Contributor

Cherry-pick of #3245 to 5_X branches.

Description
Tests are running in babelfish-for-postgresql/babelfish_extensions#3245

This change adds a number of sanity checks when ENR entries are added. Previously, there were no checks here which meant that we could run into cases we had not considered where an ENR entry could depend on a non-ENR entry, and vice-versa. When adding these tests, I discovered that there are still 3 on-disk catalogs that can be referenced by ENR entries:

pg_collation
pg_authid
pg_opclass
These catalogs can't be trivially added to ENR, so I will create some followup tasks on properly handling these cases if possible.

Note that there are still some potential limitations. For example, the issue fixed in BABEL-4868 (see babelfish-for-postgresql/babelfish_extensions#3122) would not have been caught by this change due to the way that dependency entries are created for functions as column defaults.

A way to truly guarantee that all corner cases could be caught is to implement a sort of check in Postgres' dependency code. This would be a pretty sizable change and have potential performance impact, since we would need to a) add infrastructure to allow lookups to all tuples in ENR by OID, and b) search through this structure every time we try to add a dependency. I've opted to not include that for now due to the reasons mentioned, but if there is interest in that we can have a separate discussion on it.

Issues Resolved
BABEL-4776

Task: BABEL-4776

Signed-off-by: Tim Chang <[email protected]>
@xhfanhe
Copy link
Contributor

xhfanhe commented Dec 19, 2024

16x change: #500

@xhfanhe xhfanhe merged commit f424e4d into babelfish-for-postgresql:BABEL_5_X_DEV__PG_17_X Dec 19, 2024
2 checks passed
@timchang514 timchang514 deleted the BABEL-4776-5x branch December 19, 2024 22:25
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.

2 participants