Found during the final review of #87.
src/metadata/object_resolver.rs computes a table OID with Rust's DefaultHasher. src/ddl/comment_ddl_handler.rs writes that value into __pgsqlite_comments.object_oid, which is exposed as pg_description.objoid.
Since #87, pg_class.oid comes from the canonical 3-character-prefix formula (crate::utils::generate_table_oid), which the SQLite views and the persisted pg_constraint/pg_index/pg_attrdef/pg_depend OIDs all share. The two never agree, so:
SELECT obj_description(c.oid, 'pg_class') FROM pg_class c WHERE relname = 'users';
returns NULL for every table that has a comment. This is what psql \d+ uses to show table comments.
A comment in object_resolver.rs claimed it used "the same algorithm as pg_class view". That was false and has been corrected on the #87 branch; the formula itself was deliberately left alone, because changing it would orphan every already-persisted __pgsqlite_comments row.
Fixing it properly needs a data migration that rewrites __pgsqlite_comments.object_oid to the canonical formula, alongside the code change.
Related: src/functions/catalog_functions.rs has the same problem for the regclass UDF — see the companion issue.
Found during the final review of #87.
src/metadata/object_resolver.rscomputes a table OID with Rust'sDefaultHasher.src/ddl/comment_ddl_handler.rswrites that value into__pgsqlite_comments.object_oid, which is exposed aspg_description.objoid.Since #87,
pg_class.oidcomes from the canonical 3-character-prefix formula (crate::utils::generate_table_oid), which the SQLite views and the persistedpg_constraint/pg_index/pg_attrdef/pg_dependOIDs all share. The two never agree, so:returns NULL for every table that has a comment. This is what psql
\d+uses to show table comments.A comment in
object_resolver.rsclaimed it used "the same algorithm as pg_class view". That was false and has been corrected on the #87 branch; the formula itself was deliberately left alone, because changing it would orphan every already-persisted__pgsqlite_commentsrow.Fixing it properly needs a data migration that rewrites
__pgsqlite_comments.object_oidto the canonical formula, alongside the code change.Related:
src/functions/catalog_functions.rshas the same problem for theregclassUDF — see the companion issue.