Repository navigation
Description
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
textfor every view column (honest, cheap, matches the currentELSE 'text'fallback). - Resolve through
PRAGMA table_infowhere SQLite infers a type from a passthrough column, falling back totext. - Trace simple
SELECT col FROM tviews back to the base table's__pgsqlite_schemaentry.
(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
__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.- Whichever approach is taken,
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. - Split out of information_schema.tables lists pgsqlite's materialized pg_* and information_schema_* relations #88 / fix: namespace-aware information_schema served from SQLite (#88) #103.
Activity