Repository navigation
Description
Summary
pg_type was promoted in this window from a decorating relation to Family.TYPES, and TYPES sits at
the bottom of the family ranking on purpose. That reading is right for pg_class and pg_attribute
and wrong for pg_namespace: a query joining pg_type to pg_namespace is a question about
types, and it is answered as a question about schemas, returning one fabricated row whose
type columns are all NULL.
This breaks DatabaseMetaData.getTypeInfo() in the PostgreSQL JDBC driver.
Where (HEAD 471498d)
postgresw/.../PostgresCatalog.java:141and:188(relation registry):335-337(family selection),:410-437(mostSpecific/rank),:838-844(Row.complete)
The ranking:
case SCHEMAS -> 1;
case TABLES, VIEWS -> 2;
case COLUMNS -> 3;
default -> 0; // TYPESwith the stated rationale: "TYPES stays at the bottom on purpose: pg_type joined to pg_class or
pg_attribute is a question about tables or columns that happens to name the type of each."
That is correct for those two. But pg_namespace is registered as Family.SCHEMAS, rank 1, and a
query whose only other relation is pg_namespace is asking about types, joined to pg_namespace
purely to qualify each type's schema. mostSpecific picks SCHEMAS, so buildRows returns
List.of(schemaRow(context).complete()) - a single row.
Row.complete() then fills every column of every registered relation with null, so the pg_type
columns on that schema row resolve to NULL rather than to "no such column", and the projection
validates and is accepted. The caller gets a well-formed answer that is entirely fabricated.
Repro
DatabaseMetaData.getTypeInfo() sends:
SELECT t.typname,t.oid FROM pg_catalog.pg_type t
JOIN pg_catalog.pg_namespace n ON (t.typnamespace = n.oid)
WHERE n.nspname != 'pg_toast' AND (...)Family resolves to SCHEMAS. The single schema row survives the filter, because its nspname is the
database name and the trailing scalar subquery makes the WHERE unreadable - which for a non-TYPES
family is tolerated and drops the filter entirely. The projection t.typname, t.oid yields
(NULL, NULL).
So getTypeInfo() returns one type whose name and OID are null, instead of the type list. Any tool
that populates a type picker or validates a column type against the catalog gets a single nameless
entry. Notably it does not error, so the failure is silent at the driver level.
Suggested fix
Rank by what the query is actually about rather than by relation alone. The distinction that matters
is whether the non-TYPES relation constrains the row set or merely qualifies it:
pg_classandpg_attributejoined topg_typeconstrain it, so the current ranking is right.pg_namespacejoined topg_typequalifies it, so TYPES should win.
The narrow version is to exclude pg_namespace from the relations that outrank TYPES, since it is
the only registered SCHEMAS relation and its role in a type query is always qualification. A
principled version is to give each relation a weight for "can be a lone subject" versus "only ever
decorates", and pick the highest subject present.
Separately worth hardening: Row.complete() filling foreign columns with NULL is what turns a
mis-routed query into a plausible answer instead of an error. A projection naming a column the chosen
family does not own could be rejected rather than nulled - that would have made this loud.
Scope / confidence
Confidence high on the mechanism; each step (the ranking, pg_namespace's family, mostSpecific,
and Row.complete's null fill) was read in the tree.
Related but filed separately: the two pg_type surfaces disagree on which columns exist.
Activity
docs(#7224): the comment on pg_type's registration outlived the ranki…
test(#7224): pin the tie the ranking stopped leaving to FROM order, a…
refactor(#7224): one constant for the pg_catalog schema name, not fou…
Merge pull request #7246 from ArcadeData/fix/issue-7222-7223-7224
lvca commentedon Sep 7, 2026
Fixed in #7246, released in 26.10.1.
Over the PostgreSQL wire protocol,
DatabaseMetaData.getTypeInfo()returned a single type with a null name and null OID instead of the list of supported types. The query it sends joinspg_typetopg_namespace, and the catalog emulation read that as a question about schemas rather than about types — then filled the type columns with nulls, so the driver got a well-formed but entirely made-up answer, with no error to hint at it.Any tool that populates a type picker or validates a column type against the catalog got that one nameless entry.
What changed
A relation joined only to qualify each row (such as
pg_namespace, which just names the schema of each type) no longer decides what the query is about. Relations that genuinely narrow the result —pg_class,pg_attribute— still do, so table and column metadata queries are unaffected.getTypeInfo()now returns the real type list. No client-side change is needed.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#7223,ArcadeData#7222,ArcadeData#7224): disk space on t…
fix(#7868,#7905,#7858,#7906,#7895): carry the owner row, answer trans…
fix(#7868,#7858,#7895): one singleton row for every family this catal…
test(postgresw): consolidate the issue-named postgresw tests into top…