duckdb / duckdb/duckdb-postgres

Problem updating Postgres ENUM from DuckDB

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

Description

### What happens?

I'm on DuckDB 1.4.1 experiencing difficulty updating a Postgres 17.6 ENUM field status:

`Not implemented Error` `Enums in Postgres must be named - unnamed enums are not supported. Use CREATE TYPE to create a named enum.`

All of the following give me the above error:

```
update mypg.mytable set status=ddb.status where ddb.id=mypg.mytable.id;
update mypg.mytable set status=ddb.status::varchar where ddb.id=mypg.mytable.id;
update mypg.mytable set status=ddb.status::text where ddb.id=mypg.mytable.id;
update mypg.mytable set status=ddb.status::mypg.mystatus_enum where ddb.id=mypg.mytable.id;
```

Both for DuckDB sources and PG sources, e.g.:

`update mypg.mytable set status=mypg.mytable2.status where mypg.mytable2.id=mypg.mytable.id;`

and as above but with PG sources.

Making a similar update from within Postgres withough DuckDB is not a problem.

I've also tried using an equivalent ENUM declared in DuckDB.

### To Reproduce

```
CREATE TYPE mystatus_enum AS ENUM (
'IN_STOCK', 'OUT_OF_STOCK', 'NOT_FOUND', 'NOT_A_PRODUCT'
);

CREATE TABLE mytable
(
id INTEGER primary key,
status mystatus_enum
);
```

### OS:

Linux

### PostgreSQL Version:

17.6

### DuckDB Version:

1.4.1

### DuckDB Client:

Python

### Full Name:

Rui Da Costa

### Affiliation:

startup

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

- [ ] 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.