Skip to content

DuckLake fails to create inlined data tables with DOUBLE columns for Postgres catalogue. #637

@akashsharma95

Description

@akashsharma95

What happens?

Description

DuckLake fails when creating inlined data tables in PostgreSQL that contain DOUBLE type columns. The error occurs because DuckLake generates PostgreSQL DDL using DOUBLE directly.

Steps to Reproduce

  1. Attach DuckLake to a PostgreSQL database with data inlining enabled
  2. Create a table with DOUBLE columns.
  3. Insert data with data inlining enabled.

Expected Behavior

The table should be created successfully and data should be inlined in PostgreSQL.

Actual Behavior

The table creation fails with the following error:
2025/12/22 10:59:30 ERROR failed to create table error="TransactionContext Error: Failed to commit: Failed to commit DuckLake transaction.\nFailed to flush changes into DuckLake: Failed to execute query \"INSERT INTO \"public\".ducklake_table VALUES (1, '019b45b6-dac1-7ce3-b96b-be7998fd84f1', 1, NULL, 0, 'events', 'events/', true);INSERT INTO \"public\".ducklake_column VALUES (1, 1, NULL, 1, 1, 'id', 'int32', NULL, NULL, true, NULL),(2, 1, NULL, 1, 2, 'latitude', 'float64', NULL, NULL, true, NULL),(3, 1, NULL, 1, 3, 'longitude', 'float64', NULL, NULL, true, NULL);INSERT INTO \"public\".ducklake_inlined_data_tables VALUES (1, 'ducklake_inlined_data_1_1', 1);CREATE TABLE IF NOT EXISTS \"public\".ducklake_inlined_data_1_1(row_id BIGINT, begin_snapshot BIGINT, end_snapshot BIGINT, id INTEGER, latitude DOUBLE, longitude DOUBLE);INSERT INTO \"public\".ducklake_snapshot VALUES (1, NOW(), 1, 2, 0);INSERT INTO \"public\".ducklake_snapshot_changes VALUES (1, 'created_table:\"main\".\"events\"', NULL, NULL, NULL);INSERT INTO \"public\".ducklake_schema_versions VALUES (1,1);\": ERROR: type \"double\" does not exist\nLINE 1: ...BIGINT, end_snapshot BIGINT, id INTEGER, latitude DOUBLE, lo...\n

To Reproduce

//go:build ignore
// +build ignore

package main

import (
	"database/sql"
	"fmt"
	"io"
	"log/slog"
	"os"
	"time"

	_ "github.com/duckdb/duckdb-go/v2"
	embeddedpostgres "github.com/fergusstrange/embedded-postgres"
)

func main() {
	postgres := embeddedpostgres.NewDatabase(embeddedpostgres.DefaultConfig().Logger(io.Discard))
	if err := postgres.Start(); err != nil {
		slog.Error("failed to start embedded postgres", "error", err)
		return
	}
	defer postgres.Stop()

	dataPath := fmt.Sprintf("/tmp/ducklake-%d", time.Now().UnixNano())
	os.MkdirAll(dataPath, 0755)
	defer os.RemoveAll(dataPath)

	conn, err := sql.Open("duckdb", "")
	if err != nil {
		slog.Error("failed to open duckdb", "error", err)
		return
	}
	defer conn.Close()

	conn.Exec("FORCE INSTALL ducklake FROM core_nightly")
	conn.Exec("INSTALL postgres")
	conn.Exec("LOAD ducklake")
	conn.Exec("LOAD postgres")

	attachSQL := fmt.Sprintf("ATTACH 'ducklake:postgres:dbname=postgres host=localhost port=5432 user=postgres password=postgres' AS lake (DATA_PATH '%s', DATA_INLINING_ROW_LIMIT 10)", dataPath)
	if _, err := conn.Exec(attachSQL); err != nil {
		slog.Error("failed to attach ducklake", "error", err)
		return
	}

	_, err = conn.Exec("CREATE TABLE IF NOT EXISTS lake.events (id INTEGER, latitude DOUBLE, longitude DOUBLE)")
	if err != nil {
		slog.Error("failed to create table", "error", err)
		return
	}

	_, err = conn.Exec("INSERT INTO lake.events VALUES (1, 37.7749, -122.4194)")
	if err != nil {
		slog.Error("insert failed", "error", err)
		return
	}

	slog.Info("insert succeeded")
}

OS:

aarch64

DuckDB Version:

1.4.3

DuckLake Version:

0.3

DuckDB Client:

Go

Hardware:

No response

Full Name:

Akash Sharma

Affiliation:

Paddle

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

I have tested with a nightly build

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

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

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

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions