hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.1k stars 2.77k forks source link

v1.3.3 / PostgreSQL 13.1 on mutation: could not identify an equality operator for type point #6539

Open kamek-pf opened 3 years ago

kamek-pf commented 3 years ago

The following query

mutation M ($mac: macaddr!, $name: String!, $pos: point!) {
  updateAccessPoint(pk_columns: {mac: $mac}, _set: {name: $name, positionOnFloorplan: $pos}) {
    mac
    positionOnFloorplan
  }
}

with the following payload:

{
  "mac": "88:88:88:88:88:88",
  "name": "test",
  "pos": "(1,1)"
}

Sometimes (?) fails with :

{
  "errors": [
    {
      "extensions": {
        "internal": {
          "statement": "WITH \"access_points__mutation_result_alias\" AS (UPDATE \"public\".\"access_points\" SET \"name\" = ($1)::text,\"position_on_floorplan\" = ($2)::point  WHERE (('true') AND (((((\"public\".\"access_points\".\"mac\") = (($3)::macaddr)) AND ('true')) AND ('true')) AND ('true'))) RETURNING * , CASE WHEN 'true' THEN NULL ELSE \"hdb_catalog\".\"check_violation\"('update check constraint failed')  END ), \"access_points__all_columns_alias\" AS (SELECT  \"mac\" , \"serial_number\" , \"name\" , \"model\" , \"manufacturer\" , \"zone_id\" , \"floorplan_id\" , \"position_on_floorplan\" , \"radius_on_floorplan\" , \"is_ours\" , \"created_at\" , \"updated_at\" , \"is_deleted\"  FROM \"access_points__mutation_result_alias\"      ) SELECT  (SELECT  coalesce((json_agg(\"root\" )->0), 'null' ) AS \"root\" FROM  (SELECT  row_to_json((SELECT  \"_1_e\"  FROM  (SELECT  \"_0_root.base\".\"mac\" AS \"mac\", \"_0_root.base\".\"position_on_floorplan\" AS \"positionOnFloorplan\"       ) AS \"_1_e\"      ) ) AS \"root\" FROM  (SELECT  *  FROM \"access_points__all_columns_alias\" WHERE ('true')     ) AS \"_0_root.base\"      ) AS \"_2_root\"      )        ",
          "prepared": false,
          "error": {
            "exec_status": "FatalError",
            "hint": null,
            "message": "could not identify an equality operator for type point",
            "status_code": "42883",
            "description": null
          },
          "arguments": [
            "(Oid 25,Just (\"test\",Binary))",
            "(Oid 0,Just (\"(1,1)\",Text))",
            "(Oid 0,Just (\"88:88:88:88:88:88\",Text))"
          ]
        },
        "path": "$",
        "code": "unexpected"
      },
      "message": "database query error"
    }
  ]
}

The weird thing is that if I change a field other than the point one (in this example, name for instance), the query succeeds. But only once, if I rerun the same mutation, it starts failing again.

Might be a query caching thing ?

tirumaraiselvan commented 3 years ago

Any chance you can replicate this in v2.0 (which no longer uses query plan caching) ?