mlipscombe/postgraphile-plugin-nested-mutations

Delete by multiple primary keys

Opened this issue · 0 comments

Eldow commented

I found an issue while performing delete mutations from multiple primary keys :

       deleteByCarIdAndBrandId: [
          {
            carId: 514,
            brandId: 43
          }
        ]

Pg compiler outputs an error : Unpexcted character ')'

After some reseach, I looked at the computed query and it looks like this :

delete from "public"."Cars"\n' +
                where \n' +
                    "car_id" = $1\n' +
                  ) and (\n' +
                    "brand_id" = $2\n' +

Fixed it by wrapping the where clause inside parenthesis.

Let me know if I should make a PR for this !