Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Inserting data Clickhouse RETURNING is not supported #94

Open
bastiaanv opened this issue May 20, 2023 · 3 comments
Open

[Bug] Inserting data Clickhouse RETURNING is not supported #94

bastiaanv opened this issue May 20, 2023 · 3 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@bastiaanv
Copy link

Bug report

Describe the bug

When inserting data via Supabase-js / Postgrest, I get a 500 error response with the following body:

{
    "code": "HV000",
    "details": "Wrappers",
    "hint": null,
    "message": "RETURNING is not supported"
}

To Reproduce

Clickhouse table:

CREATE TABLE glucose
(
    `timestamp` DateTime64(3, 'Europe/Amsterdam'),
    `profile_id` String,
    `sensor_id` String,
    `glucose_mmol` Float32,
    `glucose_mg` Int16
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(timestamp)
ORDER BY (timestamp, profile_id);

Postgres table:

create server clickhouse_server
  foreign data wrapper clickhouse_wrapper
  options (
    conn_string 'tcp://default:@localhost:9000/default'
  );

create foreign table glucose (
  timestamp timestamp,
  profile_id text,
  sensor_id text,
  glucose_mmol real,
  glucose_mg integer
)
  server clickhouse_server
  options (
    table 'glucose',
    rowid_column 'timestamp'
  );

You can reproduce this error by trying to insert the following data (but any data will do):

const uploadData = {"sensor_id":"b4d0f5a6-5fe3-4341-90c2-c18baedeb31f","timestamp":"2023-05-20T19:34:00.000Z","glucose_mg":222,"glucose_mmol":12.3,"profile_id":"c7922835-bdc9-49eb-a3f5-0d3013c67bbf"};
Supabase.from('glucose').insert(uploadData)

Expected behavior

To insert the data and not give me an error

System information

  • OS: MacOs
  • Browser: Safari iOS
  • Version of supabase-js: v2.21.0
  • Version of Node.js: v19.6.1
@bastiaanv bastiaanv added the bug Something isn't working label May 20, 2023
@burmecia
Copy link
Member

That's an expected result. Supabase uses PostgREST as API server which uses RETURNING for all insert sql statements, but Wrappers doesn't support RETURNING clause at this moment. Would it possible encapsulate the insert into a function, and call that function instead?

@bastiaanv
Copy link
Author

Yes, that worked. Thanks!

Do you think postgrest can be configured to work without the returning?

@burmecia burmecia added the wontfix This will not be worked on label Sep 1, 2023
kamyshdm pushed a commit to dymium-io/supabase-wrappers that referenced this issue Jun 17, 2024
@evokelektrique
Copy link

I have the same issue. I resolved it by using the official ClickHouse JavaScript client for inserting data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants