Giter VIP home page Giter VIP logo

Comments (4)

Tishj avatar Tishj commented on September 26, 2024
import duckdb
conn = duckdb.connect()

conn.sql(
    f"""
        DROP TABLE IF EXISTS meta_test;

        CREATE TABLE meta_test (
            id TEXT NOT NULL UNIQUE,                
            last_ts TIMESTAMPTZ,
            first_ts TIMESTAMPTZ,
            PRIMARY KEY (id),
        );            
    """
)

conn.sql(
    f"""
        INSERT INTO meta_test (id, last_ts, first_ts)
        VALUES ('uuid42', NULL, NULL)
        ON CONFLICT (id)
        DO UPDATE 
        SET last_ts = NULL
        """
)

runs without problems

from duckdb.

Tishj avatar Tishj commented on September 26, 2024
statement ok
CREATE TABLE meta_test (
	id TEXT NOT NULL UNIQUE,
	last_ts TIMESTAMPTZ,
	first_ts TIMESTAMPTZ,
	PRIMARY KEY (id),
);

statement ok
INSERT INTO meta_test (id, last_ts, first_ts)
VALUES ('uuid42', NULL, NULL)
ON CONFLICT (id)
DO UPDATE
SET last_ts = NULL

statement ok
INSERT INTO meta_test (id, last_ts, first_ts)
VALUES ('uuid42', NULL, NULL)
ON CONFLICT (id)
DO UPDATE
SET last_ts = NULL

query III
select * from meta_test;
----
uuid42	NULL	NULL

also runs without problems

from duckdb.

jhabermas avatar jhabermas commented on September 26, 2024

Could it be postgres extension specific then?

Here's my connection setup:

duckdb.install_extension("postgres")
duckdb.load_extension("postgres")

def postgres_connection(tz="UTC"):
    db_config = settings[env_settings.ts_datastore]
    conn = duckdb.connect(
        f"postgres:user={db_config.user} password={db_config.password} host={db_config.host} dbname={db_config.db_name}"
    )
    conn.sql(f"SET timezone to '{tz}'")
    return conn

Edit: appears to be the case, the query works fine if I use in-memory database, but fails when connected to postgres.

from duckdb.

Tishj avatar Tishj commented on September 26, 2024

duckdb/postgres_scanner#189

from duckdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.