Repository navigation
Add the catalog visibility and comment functions - #161
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the catalog information functions of spec/07 section 7.18.3 that read only the catalog: the
pg_*_is_visiblefunctions,pg_get_userbyidand the comment functions. It is part of theSELECTitem of M2.What changes
rupg-funchas a new modulecatinfo.rs. It has the kernels ofpg_table_is_visible,pg_type_is_visible,pg_function_is_visible,pg_operator_is_visible,pg_opclass_is_visible,pg_opfamily_is_visible,pg_collation_is_visible,pg_conversion_is_visible,pg_ts_parser_is_visible,pg_ts_dict_is_visible,pg_ts_template_is_visible,pg_ts_config_is_visibleandpg_statistics_obj_is_visible.reg.rs, so it finds the object in the schemas ofsearch_pathasnamespace.cdoes. An OID that no object has gives a null. An operator class or an operator family is visible only when the first one with the same name and the same access method is the same object.pg_get_userbyidgives the name of the role, orunknown (OID=n)for an OID that no role has.obj_description,col_descriptionandshobj_descriptionare SQL functions in PostgreSQL. The engine runs a kernel for each one, with the same result as the SQL text insystem_functions.sql.rupg-pgcatalogloads the rows ofpg_descriptionandpg_shdescription, and gives the rows ofpg_ts_parser,pg_ts_template,pg_opclass,pg_opfamilyandpg_conversionby name and by OID.Limits
The catalog has the built-in objects and comments only. The objects that the scripts of initdb add, such as the system views, the ICU collations and the snowball dictionaries, are not there yet. There is no extended statistics object, so
pg_statistics_obj_is_visiblegives a null for each OID.Tests
catalog_information_functionsinrupg-execruns 85 queries. Each expected value is the output of the PostgreSQL 19 oracle for the same query. The counts over the catalogs use only the OIDs below 10000, because the scripts of initdb add more rows.cargo fmt,cargo clippy --workspace --all-targets -D warnings,cargo test --workspaceand thecargo xtaskchecks pass on server1.