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

Type errors for parameters of custom functions #1952

@AlexanderFillbrunn

Description

@AlexanderFillbrunn

Hi,
I have trouble calling following custom function from GraphQL:

CREATE FUNCTION images_in_cell(wall uuid, gridX integer, gridY integer)
RETURNS SETOF images AS $$
    SELECT *
    FROM images
    WHERE
      wall_id = wall AND
      FLOOR(x / 1000 + width / 2) = gridX AND
      FLOOR(y / 1000 + height / 2) = gridY
$$ LANGUAGE sql STABLE;

This is the query I try to submit:

query {
  images_in_cell(args:{wall: "8e3e4a14-c831-45a2-9e78-8e86028d1ee5", gridx:1, gridy:1}) {
    id
  }
}

Here the GraphiQL editor complains that it expected type Int! for the "wall" argument. If I run the query, I get following result:

{
  "errors": [
    {
      "extensions": {
        "path": "$.selectionSet.images_in_cell.args.args.gridy",
        "code": "parse-failed"
      },
      "message": "A string is expected for type : uuid"
    }
  ]
}

It seems like Hasura mixes up the argument types of wall and gridy.

I just updated Hasura to version v1.0.0-alpha41 and I am running it with PostgreSQL 11.2 using the docker-compose file provided in your quickstart documentation.
If you need any other information or want me to try something else, feel free to ask! I would also be very glad for any workaround.

Edit:
After getting some help in the discord channel: It works if I move the wall argument to the end of the argument list of my function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions