dolthub / dolthub/doltgresql

`information_schema.columns` returns blank metadata instead of view columns

Open
#3,244 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.1k
Forks
73
Avg merge
1d 10h
Merged PRs (30d)
129

Description

Doltgres does not expose view output columns correctly through `information_schema.columns`. Each view is represented by a single fabricated row with an empty column name, ordinal position `0`, and no type metadata.

### Reproduction

```sql
CREATE TABLE view_metadata_probe (
id integer,
label varchar(20)
);

CREATE VIEW view_metadata_probe_v AS
SELECT id, label
FROM view_metadata_probe;

SELECT
column_name,
ordinal_position,
data_type,
udt_schema,
udt_name
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'view_metadata_probe_v'
ORDER BY ordinal_position;
```

### Doltgres result

The view is represented by one row resembling:

```text
column_name | ordinal_position | data_type | udt_schema | udt_name
------------+------------------+-----------+------------+---------
| 0 | NULL | NULL | NULL
```

### PostgreSQL result

PostgreSQL 16 returns:

```text
column_name | ordinal_position | data_type | udt_schema | udt_name
------------+------------------+-------------------+------------+---------
id | 1 | integer | pg_catalog | int4
label | 2 | character varying | pg_catalog | varchar
```

### Impact

Schema-discovery tools and database clients cannot determine a view's columns or types through the standard information schema, even though the underlying view data is available.

### Implementation context

`getRowsFromViews` in `server/tables/information_schema/columns_table.go` currently appends one literal placeholder row for each view. It does not analyze the view definition or iterate over its output schema.

The `pg_attribute` catalog already analyzes view queries and emits one entry per output column. The information-schema implementation should similarly derive the analyzed view schema and build a normal metadata row for each output column.

This was identified as a pre-existing issue while validating dolthub/doltgresql#3241.

Contributor guide

Open the contributing guide

Research direction

Start in server/tables/information_schema/columns_table.go at getRowsFromViews and run the SQL reproduction against a view. Compare its placeholder-row logic with the pg_attribute catalog's analyzed view schema handling. Done means information_schema.columns returns one row per view output column with the correct name, ordinal position, and type metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.