postgraphile-plugin-nested-mutations icon indicating copy to clipboard operation
postgraphile-plugin-nested-mutations copied to clipboard

Delete by multiple primary keys

Open Eldow opened this issue 3 years ago • 0 comments

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 !

Eldow avatar May 17 '21 08:05 Eldow