hasura / hasura/graphql-engine

[v2.0.0-alpha.7] Found conflicting definitions for... differs from the the definition at

Open
#6,764 1 comment 2 reactions 0 assignees View on GitHub
a/data
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Just testing upgrading to v2, I get this:

```
Found conflicting definitions for \"restaurant_top_tags_args\". The definition at \"query_root.restaurant_top_tags.args\" differs from the the definition at \"query_root.review_tag_sentence.tag.restaurant_taxonomies.restaurant.top_tags.args\".","code":"unexpected"}}
```

The function in question:

```
CREATE
OR REPLACE FUNCTION public.restaurant_top_tags(
_restaurant restaurant,
tag_slugs text,
_tag_types text DEFAULT 'dish' :: text
) RETURNS SETOF restaurant_tag LANGUAGE sql STABLE AS $ function $ WITH tag_slugs_array AS (
SELECT
UNNEST(string_to_array(tag_slugs, ','))
),
tag_types AS (
SELECT
UNNEST(
string_to_array(LOWER(REPLACE(_tag_types, '-', ' ')), ',')
)
),
restaurant_tags AS (
SELECT
*
FROM
(
SELECT
DISTINCT ON (tag.name) restaurant_tag.id as rt_id,
*
FROM
restaurant_tag
JOIN tag ON restaurant_tag.tag_id = tag.id
WHERE
restaurant_tag.restaurant_id = _restaurant.id
AND tag.type IN (
SELECT
*
FROM
tag_types
)
) s
) -- TODO: How to programmtically choose just the restaurant_tag fields?
-- Selecting * conflicts with the strict return type of restaurant_tag
-- because of the JOIN.
SELECT
tag_id,
restaurant_id,
rating,
rank,
photos,
rt_id as id,
score,
score_breakdown,
review_mentions_count,
source_breakdown,
upvotes,
downvotes,
votes_ratio
FROM
(
SELECT
*
FROM
(
(
SELECT
*,
1 AS ord
FROM
restaurant_tags
WHERE
restaurant_tags.slug IN (
SELECT
*
FROM
tag_slugs_array
)
)
UNION ALL
(
SELECT
*,
2 AS ord
FROM
restaurant_tags
WHERE
NOT (
restaurant_tags.slug IN (
SELECT
*
FROM
tag_slugs_array
)
)
ORDER BY
score DESC NULLS LAST
)
) s1 -- TODO: Whether it is Postgres or Hasura, ordering by `ord` is not preserved!
-- Ordering is handled in our @graph package
ORDER BY
ord ASC
) s2 $ function $
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.