Skip to content

Inserting data fails #1375

@strokovnjaka

Description

@strokovnjaka

What happened:

when using Business Table to insert a row, I get an error from the clickhouse datasource:

Request error

Details
add Error: {
    "error":{"refId":"","message":"PGX connection lifecycle error: driver: bad connection","status":500},
    "message":"PGX connection lifecycle error: driver: bad connection\nRequest: {\n \"editorType\": \"sql\",\n \"format\": 1,\n \"meta\": {\n \"builderOptions\": {\n \"columns\": [],\n \"database\": \"\",\n \"limit\": 1000,\n \"mode\": \"list\",\n \"queryType\": \"table\",\n \"table\": \"\"\n }\n },\n \"pluginVersion\": \"4.10.2\",\n \"queryType\": \"table\",\n \"rawSql\": \"INSERT INTO testing.test (name) VALUES ('sdf')\",\n \"refId\": \"\"\n}"
}

The thing is, three rows are inserted, and the above error is reported.

What you expected to happen:

A single row to be inserted and no error reported.

How to reproduce it (as minimally and precisely as possible):

  1. create a clickhouse datasource (say you have a db called 'testing' with a table 'test', single column 'name' String), user has insert permissions
  2. create a new dashboard for the datasource
  3. add a panel of type Business Table:
    • in "Queries" put SELECT name FROM testing.test
    • in "Layout" add table test and its column name
    • in "Add data"
      • enable test and its column name
      • in "Add Request" choose datasource and put in the query INSERT INTO testing.test (name) VALUES (${payload.name:sqlstring})
  4. click on the + sign in the top right corner of the panel
  5. enter something in "name", click on the save icon on the right
  6. observe the above error
  7. refresh the panel, observer three rows inserted

Note that the same procedure works just fine with an "Microsoft SQL Server" datasource

Environment:

  • Grafana version: v11.3.0 (d9455ff7db)
  • Plugin version: 4.10.2
  • OS Grafana is installed on: ubuntu 22.04
  • User OS & Browser: any
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions