Problem
information_schema.columns and pg_attribute both report nothing for views. Each restricts to type = 'table':
information_schema_columns (migration v29, src/migration/registry.rs) — WHERE m.type = 'table'
pg_attribute (migration v26) — same restriction
This is longstanding behavior, unchanged by #103 (which rebuilt information_schema_columns but deliberately preserved the restriction to avoid widening that change's blast radius). The Rust handler #103 deleted had the same limitation, so nothing regressed — but nothing improved either.
Why it matters
Real PostgreSQL reports view columns in both surfaces. ORMs use this for view reflection: SQLAlchemy's Inspector.get_columns() works on views, and Django's inspectdb will discover a view but generate a model with no fields.
What to do
Extend both to type IN ('table', 'view').
The interesting part is type resolution. A view's columns have no PRAGMA table_info declared type in the useful sense — SQLite reports empty strings for expression columns — and no __pgsqlite_schema rows at all, since that table is populated at CREATE TABLE time. Options worth weighing:
- Report
text for every view column (honest, cheap, matches the current ELSE 'text' fallback).
- Resolve through
PRAGMA table_info where SQLite infers a type from a passthrough column, falling back to text.
- Trace simple
SELECT col FROM t views back to the base table's __pgsqlite_schema entry.
(3) is the only one that gets NUMERIC/UUID/JSONB right on a view, but it needs view-body parsing and stops working the moment an expression is involved.
Notes
Problem
information_schema.columnsandpg_attributeboth report nothing for views. Each restricts totype = 'table':information_schema_columns(migration v29,src/migration/registry.rs) —WHERE m.type = 'table'pg_attribute(migration v26) — same restrictionThis is longstanding behavior, unchanged by #103 (which rebuilt
information_schema_columnsbut deliberately preserved the restriction to avoid widening that change's blast radius). The Rust handler #103 deleted had the same limitation, so nothing regressed — but nothing improved either.Why it matters
Real PostgreSQL reports view columns in both surfaces. ORMs use this for view reflection: SQLAlchemy's
Inspector.get_columns()works on views, and Django'sinspectdbwill discover a view but generate a model with no fields.What to do
Extend both to
type IN ('table', 'view').The interesting part is type resolution. A view's columns have no
PRAGMA table_infodeclared type in the useful sense — SQLite reports empty strings for expression columns — and no__pgsqlite_schemarows at all, since that table is populated atCREATE TABLEtime. Options worth weighing:textfor every view column (honest, cheap, matches the currentELSE 'text'fallback).PRAGMA table_infowhere SQLite infers a type from a passthrough column, falling back totext.SELECT col FROM tviews back to the base table's__pgsqlite_schemaentry.(3) is the only one that gets
NUMERIC/UUID/JSONBright on a view, but it needs view-body parsing and stops working the moment an expression is involved.Notes
__pgsqlite_pg_data_typeand the other UDFs from fix: namespace-aware information_schema served from SQLite (#88) #103 are already available in SQL, so whatever mapping is chosen is reachable from the view body.data_typemust never reportintegerfor aTIMESTAMPTZcolumn — that leaks pgsqlite's internal INTEGER datetime storage onto a client-visible surface. fix: namespace-aware information_schema served from SQLite (#88) #103 has a test asserting this for tables; extend it to views.