这是indexloc提供的服务,不要输入任何密码
Skip to content

After upgrade from 1.1.0 to 1.2.0-beta.1 or 2, mutation fails with "Input has too many columns." #4035

@dminkovsky

Description

@dminkovsky

A mutation that used to work in 1.1.0 no longer works in 1.2.0-beta.1 and beta.2.

The table schema is

CREATE TABLE public."user" (                                                                                                                                                                                
    id integer NOT NULL,                                                                                                                                                                                    
    username character varying,                                                                                                                                                                             
    name character varying DEFAULT ''::character varying,                                                                                                                                                   
    location text,                                                                                                                                                                                          
    timezone text,                                                                                                                                                                                          
    delivery_time_1 text,                                                                                                                                                                                   
    delivery_time_2 text,                                                                                                                                                                                   
    is_prime boolean DEFAULT false NOT NULL,                                                                                                                                                                
    location_google_place_id text,                                                                                                                                                                          
    last_delivery_1 timestamp with time zone DEFAULT now() NOT NULL,                                                                                                                                        
    last_delivery_2 timestamp with time zone DEFAULT now() NOT NULL,                                                                                                                                        
    next_delivery timestamp with time zone,                                                                                                                                                                 
    CONSTRAINT delivery_times_different CHECK ((delivery_time_1 <> delivery_time_2)),                                                                                                                       
    CONSTRAINT user_username_valid CHECK (((username)::text ~* '^[a-z\d]{1,20}$'::text))                                                                                                                    
);
mutation ($delivery_time_1: time_of_day_enum!, $delivery_time_2: time_of_day_enum) {
  update_user(_set: {delivery_time_1: $delivery_time_1, delivery_time_2: $delivery_time_2}, where: {}) {
    returning {
      id
      delivery_time_1
      delivery_time_2
      next_delivery_string
      __typename
    }
    __typename
  }
}

with variables:

{
  "delivery_time_1": "morning",
  "delivery_time_2": null
}

The error logged by Postgres:

2020-03-05 17:29:04.682 UTC [30] ERROR:  cannot cast type record to "user" at character 901
2020-03-05 17:29:04.682 UTC [30] DETAIL:  Input has too many columns.
2020-03-05 17:29:04.682 UTC [30] STATEMENT:  WITH "public_user__mutation_result_alias" AS (UPDATE "public"."user" SET "delivery_time_1" = ($1)::text,"delivery_time_2" = NULL  WHERE (((((((("public"."user"."id") = (((current_setting('hasura.user')::json->>'x-hasura-user-id'))::integer)) OR ((("public"."user"."id") IS NULL) AND ((((current_setting('hasura.user')::json->>'x-hasura-user-id'))::integer) IS NULL))) AND ('true')) AND ('true')) AND ('true')) AND ('true')) AND (('true') AND ('true'))) RETURNING * , CASE WHEN 'true' THEN NULL ELSE "hdb_catalog"."check_violation"('update check constraint failed')  END ) SELECT  json_build_object('returning', (SELECT  coalesce(json_agg("root" ), '[]' ) AS "root" FROM  (SELECT  row_to_json((SELECT  "_1_e"  FROM  (SELECT  "_0_root.base"."id" AS "id", "_0_root.base"."delivery_time_1" AS "delivery_time_1", "_0_root.base"."delivery_time_2" AS "delivery_time_2", "public"."user_next_delivery_string"("_0_root.base")  AS "next_delivery_string", 'user' AS "__typename"       ) AS "_1_e"      ) ) AS "root" FROM  (SELECT  *  FROM "public_user__mutation_result_alias" WHERE ('true')     ) AS "_0_root.base"      ) AS "_2_root"      ), '__typename', 'user_mutation_response' ) 

To replicate:

  • I spun up 1.1.0,
  • Applied my migrations, verified the mutation worked (migration available upon request)
  • Spin up 1.2.0-beta.2
  • Mutation fails

Or just:

  • Spin up a brand new, empty 1.2.0-beta.1 or beta.2
  • Apply migrations
  • Mutation fails

Metadata

Metadata

Assignees

Labels

p/urgentImmediate action required

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions