duckdb / duckdb/duckdb-postgres

Views referencing JSON fields in PostgreSQL JSON(B) columns don't show values for them

Open
#263 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
372
Forks
105
Avg merge
10h 19m
Merged PRs (30d)
18

Description

### What happens?

When I execute a `SELECT` statement on a PostgreSQL table with a JSONB-type column that includes an output column for a field in that column (extracted via a JSONPath expression), that column yields data as expected. If I create a view for the same statement, the column remains empty.

### To Reproduce

```sql
SELECT id, json_col->'$.some_field' some_field FROM my_psql_table;
-- result contains values in some_field column ✓
CREATE VIEW my_view AS SELECT id, json_col->'$.some_field' some_field FROM my_psql_table;
FROM my_view;
-- result DOES NOT contain values in some_field column
```

### OS:

Linux

### PostgreSQL Version:

16.4

### DuckDB Version:

1.1.0

### DuckDB Client:

CLI

### Full Name:

Marco Götze

### Affiliation:

(none)

### Have you tried this on the latest `main` branch?

- [X] I agree

### Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

- [X] I agree

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.