introspection: use obj_description
/col_description
in postgres
#4136
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.
Summary
Use
obj_description
andcol_description
functions instead of manual joining onpg_description
:obj_description
in table queries for consistency (OID conflicts were fixed there in other way in fix(introspection): Add filter for oid class to PostgreSQL tables queries for description #4055)Description
When searching for database comments in
pg_description
catalog, our introspection queries for Postgres assumed that OIDs of different objects are unique, but in fact they are only unique in the containing catalog for this type of objects and not throughout the whole database. The assumption often holds true in practice in PostgreSQL because the OID generation algorithm tries to keep them separated and they only start overlapping in very big databases, however CockroachDB uses simpler IDs so they are ambiguous right away.This issue was uncovered as CockroachDB 23 added descriptions for all built-in functions, so our introspection queries started picking them up when searching for descriptions of tables, columns, views and enums.
#4055 partially fixed this in table queries by filtering by
classoid
in addition toobjoid
. It wasn't fixed in view, column and enum queries, as we learned when we tried to add CRDB 23 to CI in #4132 and it showed that some tests were failing because descriptions of random built-in functions were attached to unrelated views.This PR fixes the issue by using comment information functions instead of joining the
pg_description
catalog manually.Closes: prisma/prisma#19935
Ref: #4135
Ref: #4132