pg_duckdb icon indicating copy to clipboard operation
pg_duckdb copied to clipboard

cannot start duckdb UI

Open geoHeil opened this issue 3 months ago • 7 comments

What happens?

SELECT duckdb.install_extension('ui');
SELECT * FROM duckdb.raw_query($$ CALL start_ui(); $$);

fails with:

database-1  | 2025-08-31 10:02:57.227 UTC [191] ERROR:  (PGDuckDB/CreatePlan) Invalid Input Error: Initialization function "ui_init" from file "/var/lib/postgresql/data/pg_duckdb/extensions/v1.3.2/linux_arm64/ui.duckdb_extension" threw an exception: "Failed to create directory "/var/lib/postgresql/.duckdb/extension_data": No such file or directory"
database-1  | 2025-08-31 10:02:57.227 UTC [191] STATEMENT:  SELECT * FROM duckdb.raw_query($$ CALL start_ui(); $$)

To Reproduce

see the code above

OS:

MacOS

pg_duckdb Version (if built from source use commit hash):

52ba7aa

Postgres Version (if built from source use commit hash):

postgres:17.5-bookworm

Hardware:

M2 macbook

Full Name:

Georg Heiler

Affiliation:

Complexity Science Hub

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a source build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • [x] Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?

  • [x] Yes, I have

geoHeil avatar Aug 31 '25 10:08 geoHeil

What is your goal with running the duckdb UI from pg_duckdb? Why not use either plain duckdb, or use one of the many postgres UIs?

In any case the duckdb UI is not supported officially for now in pg_duckdb. But if you explain the usecase it might be easy to achieve.

JelteF avatar Sep 08 '25 09:09 JelteF

I think the UI of duckdb is magnificent and better than many of PG UIs. It would be neate if this could be called/started straight also from PG.

geoHeil avatar Sep 08 '25 12:09 geoHeil

The main error here seems to be Failed to create directory "/var/lib/postgresql/.duckdb/extension_data" - what happens if you create the folder?

As @JelteF mentioned, the duckdb UI is not supported officially for now in pg_duckdb, but as a contributor of both projects, I don't see why it wouldn't work :-)

Y-- avatar Sep 08 '25 12:09 Y--

Changing the dockerfile and adding

RUN mkdir -p /var/lib/postgresql/.duckdb/extension_data/ui

and in SQL

SELECT *
FROM duckdb.raw_query($$
CALL start_ui();
; $$);

shows

result: result	
VARCHAR	
[ Rows: 1]
Navigate browser to http://localhost:4213/

but no website is served

geoHeil avatar Sep 08 '25 18:09 geoHeil

If you're running it from within docker, you likely have to expose the port somehow to your host.

JelteF avatar Sep 09 '25 08:09 JelteF

Right, you should be able to EXPOSE 4213 it in the docker file or when you run it you can use the -p flag to forward it (ref)

Here's more on running duckdb-ui in docker: https://github.com/duckdb/duckdb-ui/issues/27

Y-- avatar Sep 09 '25 08:09 Y--

For me I cannot get this to work even when enabling the port

ports:
      - "5434:5432"
      - "4213:4213"

  "Ports": {
                "4213/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "4213"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "4213"
                    }
                ],

ports are mapped from docker side - but there still is no connection

geoHeil avatar Sep 09 '25 09:09 geoHeil