hasura + timescaledb on pg11 > Upserts not working anymore
See original GitHub issueHi there,
I recently switched Hasura backend db from timescale/timescaledb:1.2.1-pg10
to timescale/timescaledb:1.2.1-pg11
.
As described in this issue on Timescaledb github, when doing an UPSERT operation on an hypertable (through Graphql-engine), I’m now faced with this error: ERROR: hypertables do not support ON CONFLICT statements that reference constraints
.
To workaround this, Guys at Timescaledb advised me to instead of mentioning the constraint name (like does graphql-engine statement) :
INSERT INTO "data" ( "timestamp", "uuid" ) VALUES ( "2019-03-06T16:46:46.988Z", "9db6dbe1-cd14-1d17-38c0-4d4a36679fd6" ) ON CONFLICT ON CONSTRAINT "data_pkey" DO NOTHING RETURNING *
To explicitly mention column names (involved in the constraint):
Even though I believe the “design issue” is more on Timescaledb side, I’d be interested to hear your input on this > would that make sense for Hasura to change the way it’s working now, If not, why?
Many thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:30 (3 by maintainers)
Hello, @0x777 @marionschleifer @tirumaraiselvan, did you guys plan to release a fix to this bug? It’s soon going to be 2 years this issue is open. Reproducing should be quite straightforward:
docker pull timescale/timescaledb:latest-pg12
docker pull hasura/graphql-engine
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
as well asCREATE SCHEMA "schema1";
&CREATE TABLE "schema1"."table1" ("id" int AS IDENTITY PRIMARY KEY,"value" text NOT NULL, "timestamp" timestamp with time zone NOT NULL);
and finally runSELECT create_hypertable('schema1.table1', 'timestamp');
to convert schema.table1 to a timescale “hypertable”.with these query variables:
This will throw an “ON CONFLICT ON CONSTRAINT” error, as with Hypertables one can’t reference a primary key by its name, but only by its column names:
Your help would be much appreciated ❤️
Hello, any resolution to this issue?