duckdb / duckdb/duckdb-postgres
INSERT ... RETURNING clause returns error when inserting into Postgres table
- Dominant language
- C++
- Stars
- 372
- Forks
- 105
- Avg merge
- 10h 19m
- Merged PRs (30d)
- 18
Description
### What happens?
When attempting to insert into a Postgres table and return the auto-generated ID for use in indexing, the following error is thrown:
```
Binder Error: RETURNING clause not yet supported for insertion into Postgres table
```
This isn't mentioned in the docs [here](https://duckdb.org/docs/sql/statements/insert#returning-clause) as being unsupported, so would be great to know if it's intended or a bug!
### To Reproduce
Insert into any postgres table, e.g. for a `users` table with just an `id` and `name`:
```
INSERT INTO users (name)
VALUES (`test_name`)
RETURNING id;
```
### OS:
MacOS Sonoma 14.1
### DuckDB Version:
0.9.2
### DuckDB Client:
Python
### Full Name:
Tyler Dammann
### Affiliation:
Bruinen
### Have you tried this on the latest `main` branch?
I have tested with a main build
### Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- [X] Yes, I have
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the INSERT ... RETURNING example from the issue through the Python client against a Postgres table, using the reported 0.9.2 behavior and a current main build. Read the linked INSERT RETURNING documentation and trace the Postgres-table insertion path to determine whether the clause should work or be documented as unsupported. Done means the intended behavior is established and either the generated id is returned or the documentation clearly matches the limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100