cdaringe/postgraphile-upsert

columns with value 0.0 are removed from ON CONFLICT column list

zebehringer opened this issue · 3 comments

If the bike table has a unique constraint on serial_number and weight together, and I try to upsert a bike with weight 0.0, for example

mutation {
  upsertBike(
    where: { serial_number: "abc123", weight: 0.0 }
    input: {
      bike: {
        make: "kona"
        model: "cool-ie deluxe"
        serial_number: "abc123"
        weight: 0.0
      }
    }
  ) {
    clientMutationId
  }
}

the SQL statement that gets produced is something like

INSERT INTO bike (make,model,serial_number,weight) VALUES (...) ON CONFLICT (serial_number) DO UPDATE ...

and it gets rejected because there's no constraint on just serial_number

perhaps attributes with value 0.0 is getting filtered out because it looks like false

now that #370 is in, hopefully this is taken care of

yep all good now

actually, it doesn't look like #370 got merged (just closed). I was still using the fork. If I use 2.3.0 I still get the error when 0.0 values are provided