hasura / hasura/graphql-engine

Citus Streaming Subscription issue

Open
#10,154 0 comments 0 reactions 0 assignees View on GitHub
k/v3-bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Hi, maybe I am doing something wrong, but I cannot get streaming subs to work with a distributed table. I always get the follow error from postgres:

// ERROR: cannot perform a lateral outer join when a distributed subquery
// references a table function
// STATEMENT: SELECT "__subs"."result_id" , "__fld_resp"."root" AS "result",
// "__fld_resp"."cursor" AS "cursor" FROM UNNEST(($1)::uuid[], ($2)::json[]) AS
// "__subs ││ "("result_id", "result_vars") LEFT OUTER JOIN LATERAL (SELECT
// json_build_object('tracksummary_stream', "_tracksummary_stream"."root" ) AS
// "root", to_json("_tracksummary_stream"."cursor" ) AS "c ││ ursor" FROM
// (SELECT coalesce(json_agg("root" ORDER BY "root.pg.meta_dateTimeLastUpdate"
// ASC ), '[]' ) AS "root", json_build_object('meta_dateTimeLastUpdate',
// (MAX("root.pg.meta_dateTimeLastUpd ││ ate" ))::text ) AS "cursor" FROM
// (SELECT row_to_json((SELECT "_e" FROM (SELECT
// "_root.base"."featureCollection" AS "featureCollection" ) AS "_e" ) ) AS
// "root", "_root.base"."met ││ a_dateTimeLastUpdate" AS
// "root.pg.meta_dateTimeLastUpdate" FROM (SELECT * FROM "public"."tracksummary"
// WHERE (("public"."tracksummary"."meta_dateTimeLastUpdate") >
// ((("__subs"."result_vars"# ││ >>ARRAY['cursor',
// 'meta_dateTimeLastUpdate']))::timestamptz)) ORDER BY
// "meta_dateTimeLastUpdate" ASC LIMIT 2 ) AS "_root.base" ORDER BY
// "root.pg.meta_dateTimeLastUpdate" ASC ) AS "_root" ││ ) AS
// "_tracksummary_stream" ) AS "__fld_resp" ON ('true')

Contributor guide

Open the contributing guide

Research direction

Start with the PostgreSQL error and generated SQL in the issue body, focusing on the lateral outer join, distributed subquery, and table function. Reproduce the streaming subscription against a distributed table, then establish whether the query should be supported and verify the resulting behavior against the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgresql
Domain
backend-api-design, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.