feat: add uuid and oid types to pg_type and pg_attribute catalog tables - #4960
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for 'oid' and 'uuid' data types (and their array variants) in PGAdapter's simulated PostgreSQL system catalogs, updating metadata queries, type size mappings, and consolidating test CTEs. The feedback recommends correcting the 'typcategory' of the 'oid' type from 'N' (Numeric) to 'O' (OID) to ensure proper type classification and compatibility with client drivers.
Cloud Spanner PostgreSQL-dialect databases support the UUID and OID data types. This change adds support for discovering and inspecting these types through PGAdapter's virtual catalog tables: - Adds rows for `oid` (OID 26), `_oid` (OID 1028), `uuid` (OID 2950), and `_uuid` (OID 2951) to the virtual `pg_catalog.pg_type` table expression in `PgCatalog`, expanding the type count from 31 to 35. - Adds `atttypid`, column size, and precision mappings for `oid`, `oid[]`, `uuid`, and `uuid[]` to `pg_catalog.pg_attribute` in `PgCatalog` and `PgJdbcCatalog`. - Updates `RowDescriptionResponse.getOidTypeSize(int)` to return the fixed wire protocol lengths for `Oid.OID` (4 bytes) and `Oid.UUID` (16 bytes) instead of -1 (variable length). - Updates test catalog table expectations and adds query translation and lookup test coverage for these types.
e925e6b to
19cdb95
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for the oid and uuid data types, along with their array variants, within PGAdapter's catalog emulation. The changes update type mappings, column sizes, and OID sizes across PgCatalog, PgJdbcCatalog, and RowDescriptionResponse. Additionally, several mock server tests have been refactored to use the centralized PgCatalog.PgType.PG_TYPE_CTE constant to eliminate duplicate SQL definitions, and new unit and integration tests have been added to validate the new types. No review comments were provided, and the changes look solid and well-tested.
Cloud Spanner PostgreSQL-dialect databases support the UUID and OID data types. This change adds support for discovering and inspecting these types through PGAdapter's virtual catalog tables:
oid(OID 26),_oid(OID 1028),uuid(OID 2950), and_uuid(OID 2951) to the virtualpg_catalog.pg_typetable expression inPgCatalog, expanding the type count from 31 to 35.atttypid, column size, and precision mappings foroid,oid[],uuid, anduuid[]topg_catalog.pg_attributeinPgCatalogandPgJdbcCatalog.RowDescriptionResponse.getOidTypeSize(int)to return the fixed wire protocol lengths forOid.OID(4 bytes) andOid.UUID(16 bytes) instead of -1 (variable length).