question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Query hangs with no error

See original GitHub issue
  • EdgeDB Version: EdgeDB 1.3+804c096 (repl 1.1.1-dev.760+ee2c023)
  • OS Version: latest Mac

Steps to Reproduce:

  1. Run this (simplified) query (to access link annotations from a backlink)
with module schema select Type {
[IS ObjectType].links: {
      indexes :{ name, id },
      annotations :{ name, id },
      ancestors :{ name, id },
      bases :{ 
         name, id, __type__:{name},
         [IS Link].annotations:{name, @value}
      }
   }
} 

It just hangs, but it works with a smaller limit 10-20 and hangs with a limit 100 or no limit.

Here are the logs I could get. These are probably from a previous run of the full query

could not send data to client: Broken pipe
INFO 53024 2022-04-22T15:30:48.943 postgres: WITH "t~1" AS NOT MATERIALIZED  ( (SELECT "expr-4~2"."InheritingObject_value~1" AS "expr~4_value~1", "expr-4~2"."name_value~1" AS "name_value~2", "expr-4~2"."abstract_value~1" AS "abstract_value~2", "expr-4~2"."__type___identity~1" AS "__type___identity~2" FROM LATERAL  (SELECT "InheritingObject~3".id AS "InheritingObject_value~1", "InheritingObject~3"."f3e2ba1c-bda6-11ec-a933-7db634894ef6" AS "name_value~1", "InheritingObject~3"."f3e40e30-bda6-11ec-b69c-4574eb1d3317" AS "abstract_value~1", "InheritingObject~3".__type__ AS "__type___identity~1" FROM edgedbstd."f3e0e55c-bda6-11ec-8415-f95288fe02a3_t" AS "InheritingObject~3" CROSS JOIN LATERAL  (SELECT "expr-2~2"."expr~2_value~1" AS "expr~2_value~2" FROM LATERAL  (SELECT (NOT "InheritingObject~3"."f3e2f89c-bda6-11ec-b734-f576b7f3ab84") AS "expr~2_value~1" ) AS "expr-2~2" ) AS "expr-3~2" WHERE "expr-3~2"."expr~2_value~2" ) AS "expr-4~2" )), "t~5" AS NOT MATERIALIZED  ( (SELECT "expr-34~2"."Type_value~1" AS "expr~34_identity~1", "expr-34~2"."name_value~6" AS "name_value~7" FROM LATERAL  (SELECT "Type~2".id AS "Type_value~1", "Type~2"."f28e4dfc-bda6-11ec-aca4-2141ab93c4c8" AS "name_value~6" FROM edgedbstd."f28c6226-bda6-11ec-8630-914bc003340d_t" AS "Type~2" CROSS JOIN LATERAL  (SELECT "expr-32~2"."expr~32_value~1" AS "expr~32_value~2" FROM LATERAL  (SELECT (NOT "Type~2"."f28e86fa-bda6-11ec-abfb-c396f9a6653b") AS "expr~32_value~1" ) AS "expr-32~2" ) AS "expr-33~2" WHERE "expr-33~2"."expr~32_value~2" ) AS "expr-34~2" )), "t~10" AS NOT MATERIALIZED  ( (SELECT "expr-12~2"."ScalarType_value~1" AS "expr~12_identity~1", "expr-12~2"."enum_values_value~1" AS "enum_values_value~2" FROM LATERAL  (SELECT "ScalarType~2".id AS "ScalarType_value~1", "ScalarType~2"."f5ce0f0c-bda6-11ec-b697-fb7a98e4d909" AS "enum_values_value~1" FROM edgedbstd."f5bbd986-bda6-11ec-b8dc-f97457aa9573_t" AS "ScalarType~2" CROSS JOIN LATERAL  (SELECT "expr-10~2"."expr~10_value~1" AS "expr~10_value~2" FROM LATERAL  (SELECT (NOT "ScalarType~2"."f5bf197a-bda6-11ec-836c-6171c0025d19") AS "expr~10_value~1" ) AS "expr-10~2" ) AS "expr-11~2" WHERE "expr-11~2"."expr~10_value~2" ) AS "expr-12~2" )), "t~12" AS NOT MATERIALIZED  ( (SELECT "expr-16~2"."Constraint_value~1" AS "expr~16_identity~1", "expr-16~2"."name_value~14" AS "name_value~15", "expr-16~2"."expr_serialized~1" AS "expr_serialized~2", "expr-16~2"."subject_identity~1" AS "subject_identity~2", "expr-16~2"."return_typemod_serialized~1" AS "return_typemod_serialized~2", "expr-16~2"."return_type_identity~1" AS "return_type_identity~2", "expr-16~2"."errmessage_serialized~1" AS "errmessage_serialized~2" FROM LATERAL  (SELECT "Constraint~2".id AS "Constraint_value~1", "Constraint~2"."f497f512-bda6-11ec-905a-5d55be18f4f5" AS "name_value~14", "Constraint~2"."f4a2ca14-bda6-11ec-a231-6bfdad7ffce0" AS "expr_serialized~1", "Constraint~2"."f4fc9756-bda6-11ec-a849-9b4f6e084269" AS "subject_identity~1", "Constraint~2"."f49d9ba2-bda6-11ec-86ce-4903a7e63962" AS "return_typemod_serialized~1", "Constraint~2"."f49cea7c-bda6-11ec-8e07-81bcfd0a8ae6" AS "return_type_identity~1", "Constraint~2"."f4a36ea6-bda6-11ec-9575-7b150fa5a82b" AS "errmessage_serialized~1" FROM edgedbstd."f49572ba-bda6-11ec-ac29-ef9c0a94eee0_t" AS "Constraint~2" CROSS JOIN LATERAL  (SELECT "expr-14~2"."expr~14_value~1" AS "expr~14_value~2" FROM LATERAL  (SELECT (NOT "Constraint~2"."f4983e32-bda6-11ec-90e0-1fc6a34d0c48") AS "expr~14_value~1" ) AS "expr-14~2" ) AS "expr-15~2" WHERE "expr-15~2"."expr~14_value~2" ) AS "expr-16~2" )), "t~14" AS NOT MATERIALIZED  ( (SELECT "expr-20~2"."Annotation_value~1" AS "expr~20_identity~1", "expr-20~2"."name_value~18" AS "name_value~19" FROM LATERAL  (SELECT "Annotation~2".id AS "Annotation_value~1", "Annotation~2"."f3b0e44c-bda6-11ec-bffd-27dec7ca0819" AS "name_value~18" FROM edgedbstd."f3af283c-bda6-11ec-9b14-998c69285076_t" AS "Annotation~2" CROSS JOIN LATERAL  (SELECT "expr-18~2"."expr~18_value~1" AS "expr~18_value~2" FROM LATERAL  (SELECT (NOT "Annotation~2"."f3b11872-bda6-11ec-8d49-650265303d0c") AS "expr~18_value~1" ) AS "expr-18~2" ) AS "expr-19~2" WHERE "expr-19~2"."expr~18_value~2" ) AS "expr-20~2" )), "t~16" AS NOT MATERIALIZED  ( (SELECT "expr-25~2"."ConsistencySubject_value~1" AS "expr~25_identity~1", "expr-25~2"."name_value~21" AS "name_value~22" FROM LATERAL  (SELECT "ConsistencySubject~2".id AS "ConsistencySubject_value~1", "ConsistencySubject~2"."f4dd5bfc-bda6-11ec-96d8-073148e8c55a" AS "name_value~21" FROM edgedbstd."f4db97e0-bda6-11ec-8030-6b127f9e3775_t" AS "ConsistencySubject~2" CROSS JOIN LATERAL  (SELECT "expr-23~2"."expr~23_value~1" AS "expr~23_value~2" FROM LATERAL  (SELECT (NOT "ConsistencySubject~2"."f4dd8e2e-bda6-11ec-a337-2ded16291c6c") AS "expr~23_value~1" ) AS "expr-23~2" ) AS "expr-24~2" WHERE "expr-24~2"."expr~23_value~2" ) AS "expr-25~2" )), "t~18" AS NOT MATERIALIZED  ( (SELECT "expr-30~2"."Parameter_value~1" AS "expr~30_identity~1", "expr-30~2"."name_value~24" AS "name_value~25", "expr-30~2"."type_identity~1" AS "type_identity~2" FROM LATERAL  (SELECT "Parameter~2".id AS "Parameter_value~1", "Parameter~2"."f40a0fc2-bda6-11ec-b6a0-f1d5258f5bbe" AS "name_value~24", "Parameter~2"."f40bdb7c-bda6-11ec-962f-dbd5d60bcf66" AS "type_identity~1" FROM edgedbstd."f4084fc0-bda6-11ec-bc15-7f963fbda5ef_t" AS "Parameter~2" CROSS JOIN LATERAL  (SELECT "expr-28~2"."expr~28_value~1" AS "expr~28_value~2" FROM LATERAL  (SELECT (NOT "Parameter~2"."f40a4474-bda6-11ec-b1cf-43822180c69a") AS "expr~28_value~1" ) AS "expr-28~2" ) AS "expr-29~2" WHERE "expr-29~2"."expr~28_value~2" ) AS "expr-30~2" )) SELECT COALESCE(json_agg("InheritingObject_serialized~1"), '[]') FROM (SELECT to_json(json_build_object('id', "q~1"."expr~4_value~2", 'name', "q~1"."name_value~3", 'is_abstract',  (SELECT to_json("bool_is_abstract~2"."expr~49_serialized~1") AS "is_abstract_serialized~1" FROM LATERAL  (SELECT "expr-49~2"."abstract_value~12" AS "expr~49_value~1", "expr-49~2"."abstract_serialized~5" AS "expr~49_serialized~1" FROM LATERAL  (SELECT "bool_abstract~4"."abstract_value~11" AS "abstract_value~12", "bool_abstract~4"."abstract_serialized~4" AS "abstract_serialized~5" FROM LATERAL  (SELECT "q~7"."abstract_value~10" AS "abstract_value~11", "q~7"."abstract_serialized~3" AS "abstract_serialized~4" FROM LATERAL  (SELECT ("m~1" = first_value("m~1") OVER ()) AS "m~1", "q~6"."abstract_value~8" AS "abstract_value~10", "q~6"."abstract_serialized~1" AS "abstract_serialized~3" FROM LATERAL  ( (SELECT 1 AS "m~1", "q~5"."expr~47_value~2" AS "abstract_value~8", "q~5"."expr~47_value~2" AS "abstract_serialized~1" FROM LATERAL  (SELECT "expr-47~2"."expr~47_value~1" AS "expr~47_value~2" FROM LATERAL  (SELECT "q~3"."abstract_value~6" AS "abstract_value~7" FROM LATERAL  (SELECT ("m~2" = first_value("m~2") OVER ()) AS "m~2", "q~2"."abstract_value~4" AS "abstract_value~6" FROM LATERAL  ( (SELECT 1 AS "m~2", "q~1"."abstract_value~3" AS "abstract_value~4" WHERE ("q~1"."abstract_value~3" IS NOT NULL) ) UNION ALL  (SELECT 2 AS "m~2", "v~2"."f3e40e30-bda6-11ec-b69c-4574eb1d3317~1" AS "abstract_value~5" FROM (SELECT (NULL)::bool AS "f3e40e30-bda6-11ec-b69c-4574eb1d3317~1") AS "v~2" ) ) AS "q~2" ) AS "q~3" WHERE "q~3"."m~2" ) AS "bool_abstract~3" CROSS JOIN LATERAL  (SELECT COALESCE("bool_abstract~3"."abstract_value~7", "expr-46~2"."expr~45_value~2") AS "expr~47_value~1" FROM LATERAL  (SELECT "expr-45~2"."expr~45_value~1" AS "expr~45_value~2" FROM LATERAL  (SELECT edgedbstd."std|cast@std|json@std|bool_f"("expr-44~2"."expr~44_value~2") AS "expr~45_value~1" FROM LATERAL  (SELECT "q~4"."expr~44_value~1" AS "expr~44_value~2" FROM LATERAL  (SELECT edgedbstd."f23327a6-bda6-11ec-bb3c-210187bb839c"(('false')::text) AS "expr~44_value~1" ) AS "q~4" ) AS "expr-44~2" ) AS "expr-45~2" ) AS "expr-46~2" ) AS "expr-47~2" ) AS "q~5" WHERE ("q~5"."expr~47_value~2" IS NOT NULL) ) UNION ALL  (SELECT 2 AS "m~1", "v~1"."f3e40e30-bda6-11ec-b69c-4574eb1d3317~2" AS "abstract_value~9", "v~1"."f3e40e30-bda6-11ec-b69c-4574eb1d3317~2" AS "abstract_serialized~2" FROM (SELECT (NULL)::bool AS "f3e40e30-bda6-11ec-b69c-4574eb1d3317~2") AS "v~1" ) ) AS "q~6" ) AS "q~7" WHERE "q~7"."m~1" ) AS "bool_abstract~4" ) AS "expr-49~2" ) AS "bool_is_abstract~2" ), 'bases',  (SELECT COALESCE(array_agg("aggw~1"."bases_serialized~2"), (ARRAY[])::json[]) AS "v~3" FROM (SELECT to_json("InheritingObject_bases~3"."bases_serialized~1") AS "bases_serialized~2" FROM LATERAL  (SELECT "q~8"."expr~4_identity~1" AS "bases_value~1", json_build_object('id', "q~8"."expr~4_identity~1", 'name', "q~8"."name_value~4") AS "bases_serialized~1" FROM edgedbstd."f3e70a86-bda6-11ec-93bf-b95ed62a59ec_t" AS "bases~1" INNER JOIN LATERAL  (SELECT "t~3"."expr~4_value~1" AS "expr~4_identity~1", "t~3"."name_value~2" AS "name_value~4" FROM "t~1" AS "t~3" ) AS "q~8" ON ("bases~1".target = "q~8"."expr~4_identity~1") WHERE ("q~1"."expr~4_value~2" = "bases~1".source) ) AS "InheritingObject_bases~3" ) AS "aggw~1" ), 'ancestors',  (SELECT COALESCE(array_agg("aggw~2"."ancestors_serialized~2"), (ARRAY[])::json[]) AS "v~4" FROM (SELECT to_json("InheritingObject_ancestors~3"."ancestors_serialized~1") AS "ancestors_serialized~2" FROM LATERAL  (SELECT "q~9"."expr~4_identity~2" AS "ancestors_value~1", json_build_object('id', "q~9"."expr~4_identity~2", 'name', "q~9"."name_value~5") AS "ancestors_serialized~1" FROM edgedbstd."f3e7dd62-bda6-11ec-9505-352d4814691e_t" AS "ancestors~1" INNER JOIN LATERAL  (SELECT "t~4"."expr~4_value~1" AS "expr~4_identity~2", "t~4"."name_value~2" AS "name_value~5" FROM "t~1" AS "t~4" ) AS "q~9" ON ("ancestors~1".target = "q~9"."expr~4_identity~2") WHERE ("q~1"."expr~4_value~2" = "ancestors~1".source) ) AS "InheritingObject_ancestors~3" ) AS "aggw~2" ), 'children',  (SELECT COALESCE(array_agg("aggw~3"."children_serialized~1"), (ARRAY[])::json[]) AS "v~5" FROM (SELECT to_json("J+C32mHmZBQMsyiU69F2uQ:t) & schema:Type)_children~1"."indirection_serialized~1") AS "children_serialized~1" FROM LATERAL  (SELECT "3dvufKQE6OPIGuOn31W3HQ:& schema:Type)_indirection~1"."bases_value~2" AS "indirection_value~1", json_build_object('id', "3dvufKQE6OPIGuOn31W3HQ:& schema:Type)_indirection~1"."bases_value~2", 'name', "3dvufKQE6OPIGuOn31W3HQ:& schema:Type)_indirection~1"."name_value~10") AS "indirection_serialized~1" FROM LATERAL  (SELECT "q~12"."bases_identity~1" AS "bases_value~2", "q~12"."name_value~9" AS "name_value~10" FROM edgedbstd."f3e70a86-bda6-11ec-93bf-b95ed62a59ec_t" AS "bases~2" INNER JOIN LATERAL  (SELECT "q~11"."expr~4_identity~3" AS "bases_identity~1", "q~10"."name_value~8" AS "name_value~9" FROM LATERAL  (SELECT "t~6"."expr~34_identity~1" AS "expr~34_identity~2", "t~6"."name_value~7" AS "name_value~8" FROM "t~5" AS "t~6" ) AS "q~10" INNER JOIN  (SELECT "t~7"."expr~4_value~1" AS "expr~4_identity~3" FROM "t~1" AS "t~7" ) AS "q~11" ON ("q~10"."expr~34_identity~2" = "q~11"."expr~4_identity~3") ) AS "q~12" ON ("bases~2".source = "q~12"."bases_identity~1") WHERE ("q~1"."expr~4_value~2" = "bases~2".target) ) AS "3dvufKQE6OPIGuOn31W3HQ:& schema:Type)_indirection~1" ) AS "J+C32mHmZBQMsyiU69F2uQ:t) & schema:Type)_children~1" ) AS "aggw~3" ), 'descendants',  (SELECT COALESCE(array_agg("aggw~4"."descendants_serialized~1"), (ARRAY[])::json[]) AS "v~6" FROM (SELECT to_json("aCPq+F2wD6CXODNZ384Vmw:& schema:Type)_descendants~1"."indirection_serialized~2") AS "descendants_serialized~1" FROM LATERAL  (SELECT "N07HXWjb75ZYuajOdy+G3A:& schema:Type)_indirection~1"."ancestors_value~2" AS "indirection_value~2", json_build_object('id', "N07HXWjb75ZYuajOdy+G3A:& schema:Type)_indirection~1"."ancestors_value~2", 'name', "N07HXWjb75ZYuajOdy+G3A:& schema:Type)_indirection~1"."name_value~13") AS "indirection_serialized~2" FROM LATERAL  (SELECT "q~15"."ancestors_identity~1" AS "ancestors_value~2", "q~15"."name_value~12" AS "name_value~13" FROM edgedbstd."f3e7dd62-bda6-11ec-9505-352d4814691e_t" AS "ancestors~2" INNER JOIN LATERAL  (SELECT "q~14"."expr~4_identity~4" AS "ancestors_identity~1", "q~13"."name_value~11" AS "name_value~12" FROM LATERAL  (SELECT "t~8"."expr~34_identity~1" AS "expr~34_identity~3", "t~8"."name_value~7" AS "name_value~11" FROM "t~5" AS "t~8" ) AS "q~13" INNER JOIN  (SELECT "t~9"."expr~4_value~1" AS "expr~4_identity~4" FROM "t~1" AS "t~9" ) AS "q~14" ON ("q~13"."expr~34_identity~3" = "q~14"."expr~4_identity~4") ) AS "q~15" ON ("ancestors~2".source = "q~15"."ancestors_identity~1") WHERE ("q~1"."expr~4_value~2" = "ancestors~2".target) ) AS "N07HXWjb75ZYuajOdy+G3A:& schema:Type)_indirection~1" ) AS "aCPq+F2wD6CXODNZ384Vmw:& schema:Type)_descendants~1" ) AS "aggw~4" ), 'constraints',  (SELECT COALESCE(array_agg("aggw~7"."constraints_serialized~2"), (ARRAY[])::json[]) AS "v~9" FROM (SELECT to_json("Constraint_constraints~4"."constraints_serialized~1") AS "constraints_serialized~2" FROM LATERAL  (SELECT "Constraint_constraints~3"."constraints_value~1" AS "constraints_value~2", json_build_object('name', "Constraint_constraints~3"."name_value~17", 'expr',  (SELECT to_json("Constraint_constraints~3"."expr_serialized~4") AS "expr_serialized~5" ), 'annotations',  (SELECT COALESCE(array_agg("aggw~5"."annotations_serialized~2"), (ARRAY[])::json[]) AS "v~7" FROM (SELECT to_json("Annotation_annotations~3"."annotations_serialized~1") AS "annotations_serialized~2" FROM LATERAL  (SELECT "q~18"."expr~20_identity~2" AS "annotations_value~1", json_build_object('name', "q~18"."name_value~20", '@value',  (SELECT to_json("annotations~1"."f49bcc1e-bda6-11ec-a8ed-43fc92edca27") AS "value_serialized~1" )) AS "annotations_serialized~1" FROM edgedbstd."f49a2f58-bda6-11ec-97ba-b18dd943a597_t" AS "annotations~1" INNER JOIN LATERAL  (SELECT "t~15"."expr~20_identity~1" AS "expr~20_identity~2", "t~15"."name_value~19" AS "name_value~20" FROM "t~14" AS "t~15" ) AS "q~18" ON ("annotations~1".target = "q~18"."expr~20_identity~2") WHERE ("Constraint_constraints~3"."constraints_value~1" = "annotations~1".source) ) AS "Annotation_annotations~3" ) AS "aggw~5" ), 'subject',  (SELECT to_json("ConsistencySubject_subject~3"."subject_serialized~1") AS "subject_serialized~2" FROM LATERAL  (SELECT "q~20"."expr~25_identity~2" AS "subject_value~1", json_build_object('name', "q~20"."name_value~23", 'id', "Constraint_constraints~3"."subject_identity~4") AS "subject_serialized~1" FROM LATERAL  (SELECT "Constraint_constraints~3"."subject_identity~4" AS "subject_identity~5" ) AS "q~19" INNER JOIN LATERAL  (SELECT "t~17"."expr~25_identity~1" AS "expr~25_identity~2", "t~17"."name_value~22" AS "name_value~23" FROM "t~16" AS "t~17" ) AS "q~20" ON ("q~19"."subject_identity~5" = "q~20"."expr~25_identity~2") ) AS "ConsistencySubject_subject~3" ), 'params',  (SELECT COALESCE(array_agg("aggw~6"."params_serialized~2"), (ARRAY[])::json[]) AS "v~8" FROM (SELECT to_json("Parameter_params~3"."params_serialized~1") AS "params_serialized~2" FROM LATERAL  (SELECT "q~21"."expr~30_identity~2" AS "params_value~1", json_build_object('name', "q~21"."name_value~26", 'type',  (SELECT to_json("Type_type~3"."type_serialized~1") AS "type_serialized~2" FROM LATERAL  (SELECT "q~23"."expr~34_identity~4" AS "type_value~1", json_build_object('name', "q~23"."name_value~27") AS "type_serialized~1" FROM LATERAL  (SELECT "q~21"."type_identity~3" AS "type_identity~4" ) AS "q~22" INNER JOIN LATERAL  (SELECT "t~20"."expr~34_identity~1" AS "expr~34_identity~4", "t~20"."name_value~7" AS "name_value~27" FROM "t~5" AS "t~20" ) AS "q~23" ON ("q~22"."type_identity~4" = "q~23"."expr~34_identity~4") ) AS "Type_type~3" ), '@value',  (SELECT to_json("params~1"."f4a285d6-bda6-11ec-a8de-b7c1c1abcd22") AS "value_serialized~2" )) AS "params_serialized~1" FROM edgedbstd."f49c0800-bda6-11ec-92eb-512807bbd815_t" AS "params~1" INNER JOIN LATERAL  (SELECT "t~19"."expr~30_identity~1" AS "expr~30_identity~2", "t~19"."name_value~25" AS "name_value~26", "t~19"."type_identity~2" AS "type_identity~3" FROM "t~18" AS "t~19" ) AS "q~21" ON ("params~1".target = "q~21"."expr~30_identity~2") WHERE ("Constraint_constraints~3"."constraints_value~1" = "params~1".source) ) AS "Parameter_params~3" ) AS "aggw~6" ), 'return_typemod',  (SELECT to_json("Constraint_constraints~3"."return_typemod_serialized~4") AS "return_typemod_serialized~5" ), 'return_type',  (SELECT to_json("Type_return_type~3"."return_type_serialized~1") AS "return_type_serialized~2" FROM LATERAL  (SELECT "q~25"."expr~34_identity~5" AS "return_type_value~1", json_build_object('name', "q~25"."name_value~28") AS "return_type_serialized~1" FROM LATERAL  (SELECT "Constraint_constraints~3"."return_type_identity~4" AS "return_type_identity~5" ) AS "q~24" INNER JOIN LATERAL  (SELECT "t~21"."expr~34_identity~1" AS "expr~34_identity~5", "t~21"."name_value~7" AS "name_value~28" FROM "t~5" AS "t~21" ) AS "q~25" ON ("q~24"."return_type_identity~5" = "q~25"."expr~34_identity~5") ) AS "Type_return_type~3" ), 'errmessage',  (SELECT to_json("Constraint_constraints~3"."errmessage_serialized~4") AS "errmessage_serialized~5" )) AS "constraints_serialized~1" FROM LATERAL  (SELECT "q~17"."expr~16_identity~2" AS "constraints_value~1", "q~17"."name_value~16" AS "name_value~17", "q~17"."expr_serialized~3" AS "expr_serialized~4", "q~17"."subject_identity~3" AS "subject_identity~4", "q~17"."return_typemod_serialized~3" AS "return_typemod_serialized~4", "q~17"."return_type_identity~3" AS "return_type_identity~4", "q~17"."errmessage_serialized~3" AS "errmessage_serialized~4" FROM LATERAL  (SELECT "t~13"."expr~16_identity~1" AS "expr~16_identity~2", "t~13"."name_value~15" AS "name_value~16", "t~13"."expr_serialized~2" AS "expr_serialized~3", "t~13"."subject_identity~2" AS "subject_identity~3", "t~13"."return_typemod_serialized~2" AS "return_typemod_serialized~3", "t~13"."return_type_identity~2" AS "return_type_identity~3", "t~13"."errmessage_serialized~2" AS "errmessage_serialized~3" FROM "t~12" AS "t~13" ) AS "q~17" WHERE ("q~17"."expr~16_identity~2" IN  (SELECT "constraints~1".target AS "constraints_identity~1" FROM LATERAL  (SELECT "q~16"."expr~12_identity~2" AS "indirection_identity~1" FROM LATERAL  (SELECT "t~11"."expr~12_identity~1" AS "expr~12_identity~2" FROM "t~10" AS "t~11" ) AS "q~16" WHERE ("q~1"."expr~4_value~2" = "q~16"."expr~12_identity~2") ) AS "ScalarType_indirection~2" INNER JOIN edgedbstd."f5c63dd6-bda6-11ec-8068-510c8c7ce91c_t" AS "constraints~1" ON ("ScalarType_indirection~2"."indirection_identity~1" = "constraints~1".source) )) ) AS "Constraint_constraints~3" ) AS "Constraint_constraints~4" ) AS "aggw~7" ), 'annotations',  (SELECT COALESCE(array_agg("aggw~8"."annotations_serialized~4"), (ARRAY[])::json[]) AS "v~10" FROM (SELECT to_json("Annotation_annotations~7"."annotations_serialized~3") AS "annotations_serialized~4" FROM LATERAL  (SELECT "Annotation_annotations~6"."annotations_value~2" AS "annotations_value~3", json_build_object('name', "Annotation_annotations~6"."name_value~30", '@value',  (SELECT to_json("annotations~3"."f5cb54c4-bda6-11ec-a51d-ad403d1c1791") AS "value_serialized~3" FROM edgedbstd."f5c9abce-bda6-11ec-b32b-81f9f3f59a0f_t" AS "annotations~3" WHERE ("Annotation_annotations~6"."annotations_value~2" = "annotations~3".target) )) AS "annotations_serialized~3" FROM LATERAL  (SELECT "q~27"."expr~20_identity~3" AS "annotations_value~2", "q~27"."name_value~29" AS "name_value~30" FROM LATERAL  (SELECT "t~23"."expr~20_identity~1" AS "expr~20_identity~3", "t~23"."name_value~19" AS "name_value~29" FROM "t~14" AS "t~23" ) AS "q~27" WHERE ("q~27"."expr~20_identity~3" IN  (SELECT "annotations~2".target AS "annotations_identity~1" FROM LATERAL  (SELECT "q~26"."expr~12_identity~3" AS "indirection_identity~2" FROM LATERAL  (SELECT "t~22"."expr~12_identity~1" AS "expr~12_identity~3" FROM "t~10" AS "t~22" ) AS "q~26" WHERE ("q~1"."expr~4_value~2" = "q~26"."expr~12_identity~3") ) AS "ScalarType_indirection~4" INNER JOIN edgedbstd."f5c9abce-bda6-11ec-b32b-81f9f3f59a0f_t" AS "annotations~2" ON ("ScalarType_indirection~4"."indirection_identity~2" = "annotations~2".source) )) ) AS "Annotation_annotations~6" ) AS "Annotation_annotations~7" ) AS "aggw~8" ), 'enum_values',  (SELECT to_json("array<std|str>_enum_values~4"."enum_values_value~7") AS "enum_values_serialized~1" FROM LATERAL  (SELECT "array<std|str>_enum_values~3"."enum_values_value~6" AS "enum_values_value~7" FROM LATERAL  (SELECT "q~29"."enum_values_value~5" AS "enum_values_value~6" FROM LATERAL  (SELECT "ScalarType_indirection~6"."enum_values_value~4" AS "enum_values_value~5" FROM LATERAL  (SELECT "q~28"."enum_values_value~3" AS "enum_values_value~4" FROM LATERAL  (SELECT "t~24"."expr~12_identity~1" AS "expr~12_identity~4", "t~24"."enum_values_value~2" AS "enum_values_value~3" FROM "t~10" AS "t~24" ) AS "q~28" WHERE ("q~1"."expr~4_value~2" = "q~28"."expr~12_identity~4") ) AS "ScalarType_indirection~6" WHERE ("ScalarType_indirection~6"."enum_values_value~4" IS NOT NULL) ) AS "q~29" ) AS "array<std|str>_enum_values~3" ) AS "array<std|str>_enum_values~4" ))) AS "InheritingObject_serialized~1" FROM (SELECT "t~2"."expr~4_value~1" AS "expr~4_value~2", "t~2"."name_value~2" AS "name_value~3", "t~2"."abstract_value~2" AS "abstract_value~3", "t~2"."__type___identity~2" AS "__type___identity~3" FROM "t~1" AS "t~2" ) AS "q~1" CROSS JOIN LATERAL  (SELECT ("expr-51~2"."expr~51_value~1" OR  "expr-53~2"."expr~53_value~1") AS "expr~55_value~1" FROM LATERAL  (SELECT "q~1"."__type___identity~3" AS "__type___identity~4" ) AS "q~30" INNER JOIN LATERAL  (SELECT "t~25"."expr~34_identity~1" AS "expr~34_identity~6" FROM "t~5" AS "t~25" ) AS "q~31" ON ("q~30"."__type___identity~4" = "q~31"."expr~34_identity~6") CROSS JOIN LATERAL  (SELECT edgedb.issubclass("q~31"."expr~34_identity~6", ('f5bbd986-bda6-11ec-b8dc-f97457aa9573')::uuid) AS "expr~51_value~1" ) AS "expr-51~2" CROSS JOIN LATERAL  (SELECT edgedb.issubclass("q~31"."expr~34_identity~6", ('f612acca-bda6-11ec-8e5f-3563f6b3294c')::uuid) AS "expr~53_value~1" ) AS "expr-53~2" ) AS "expr-55~2" WHERE "expr-55~2"."expr~55_value~1" ) AS "aggw~9"
CRITICAL 53024 2022-04-22T15:30:48.944 postgres: connection to client lost
INFO 53013 2022-04-22T15:30:49.938 edb.server: Backend connections to database edgedb: 3 were discarded, 3 were established in at least the last 1.0 seconds.
ERROR 53024 2022-04-22T15:31:21.663 postgres: more than one row returned by a subquery used as an expression

Here is the full query. The error does occur with the simplified one as well. But I’m including it for reference. The query is a slightly modified version of the first query in getTypes in the typescript query builder.

WITH
      MODULE schema,

      material_scalars := (
        SELECT ScalarType
        FILTER
          (.name LIKE 'std::%' OR .name LIKE 'cal::%')
          AND NOT .is_abstract
      )

    SELECT Type {
      id,
      name,
      is_abstract,

      kind := 'object' IF Type IS ObjectType ELSE
              'scalar' IF Type IS ScalarType ELSE
              'array' IF Type IS Array ELSE
              'tuple' IF Type IS Tuple ELSE
              'unknown',
      [IS ScalarType].constraints: {
        name,
        expr,
        annotations: { name, @value },
        subject: { name, id },
        params: { name, @value, type: { name } },
        return_typemod,
        return_type: { name },
        errmessage,
      },
      [IS ObjectType].properties: {
        name, default, required, is_abstract, abstract, builtin, is_final,
        expr, inherited_fields , final, readonly,
        computed_fields , id,
        annotations:{ name, @value },
        target:{name, id}
      } Filter .internal = false,
      [IS ScalarType].enum_values,
      is_seq := 'std::sequence' in [IS ScalarType].ancestors.name,
      # for sequence (abstract type that has non-abstract ancestor)
      single material_id := (
        SELECT x := Type[IS ScalarType].ancestors
        FILTER x IN material_scalars
        LIMIT 1
      ).id,

      [IS InheritingObject].bases: {
        id
      } ORDER BY @index ASC,
      [IS ObjectType].links: {
        indexes :{ name, id },
        annotations :{ name, id },
        ancestors :{ name, id },
        bases :{ name, id, __type__:{name}
        #, [IS Link].annotations:{name, @value} 
      },
        properties :{
          name, default, required, is_abstract, abstract, builtin, is_final,
          expr, inherited_fields , final, readonly,
          computed_fields , id,
          annotations:{ name, @value },
          target:{name, id}, constraints :{ name, id }
        },
        constraints :{ name, id },
        pointers :{ name, id },
        target :{ name, id },

        is_final,
        abstract,
        computed_fields,
        name,
        final,
        inherited_fields,
        builtin,
        internal,
        expr,
        required,
        id,
        is_abstract,
        readonly,
        cardinality,
        on_target_delete,
        default
    },
      [IS ObjectType].union_of,
      [IS ObjectType].intersection_of,
      [IS ObjectType].pointers: {
        real_cardinality := ("One" IF .required ELSE "AtMostOne") IF <str>.cardinality = "One" ELSE ("AtLeastOne" IF .required ELSE "Many"),
        name,
        target_id := .target.id,
        kind := 'link' IF .__type__.name = 'schema::Link' ELSE 'property',
        is_exclusive := exists (select .constraints filter .name = 'std::exclusive'),
        is_computed := len(.computed_fields) != 0,
        is_readonly := .readonly,
        has_default := EXISTS .default or ("std::sequence" in .target[IS ScalarType].ancestors.name),
        [IS Link].pointers: {
          real_cardinality := ("One" IF .required ELSE "AtMostOne") IF <str>.cardinality = "One" ELSE ("AtLeastOne" IF .required ELSE "Many"),
          name := '@' ++ .name,
          target_id := .target.id,
          kind := 'link' IF .__type__.name = 'schema::Link' ELSE 'property',
          is_computed := len(.computed_fields) != 0,
          is_readonly := .readonly
        } filter .name != '@source' and .name != '@target',
      } FILTER @is_owned,
      backlinks := (SELECT DETACHED Link FILTER .target = Type) {
        real_cardinality := "AtMostOne"
          IF
          EXISTS (select .constraints filter .name = 'std::exclusive')
          ELSE
          "Many",
        name := '<' ++ .name ++ '[is ' ++ std::assert_exists(
          .source.name if .source.name[:9] != 'default::' else .source.name[9:]
        ) ++ ']',
        stub := .name,
        target_id := .source.id,
        target_name := .source.name,
        indexes :{ name, id },
        annotations :{ name, @value },
        ancestors :{ name, id },
        bases :{ 
          name, id, __type__:{name}
          #,[IS Link].annotations:{name, @value}
      },
        properties :{
          name, default, required, is_abstract, abstract, builtin, is_final,
          expr, inherited_fields , final, readonly,
          computed_fields , id,
          annotations:{ name, @value },
          target:{name, id}
        },
        constraints :{ name, id },
        pointers :{ name, id },
        target :{ name, id },
        is_computed := len(.computed_fields) != 0,
        is_final,
        abstract,
        computed_fields,
        final,
        inherited_fields,
        builtin,
        internal,
        expr,
        required,
        id,
        is_abstract,
        readonly,
        cardinality,
        on_target_delete,
        default,
        kind := 'link',
        is_exclusive := (EXISTS (select .constraints filter .name = 'std::exclusive')) AND <str>.cardinality = "One",
      },
      backlink_stubs := array_agg((
        WITH
          stubs := DISTINCT (SELECT DETACHED Link FILTER .target = Type).name,
          baseObjectId := (SELECT DETACHED ObjectType FILTER .name = 'std::BaseObject' LIMIT 1).id
        FOR stub in { stubs }
        UNION (
          SELECT {
            real_cardinality := "Many",
            name := '<' ++ stub,
            target_id := baseObjectId,
            kind := 'link',
            is_exclusive := false,
          }
        )
      )),
      array_element_id := [IS Array].element_type.id,

      tuple_elements := (SELECT [IS Tuple].element_types {
        target_id := .type.id,
        name
      } ORDER BY @index ASC),
    }
    ORDER BY .name;
  `

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
msullivancommented, Jun 24, 2022

Alright, the bug that showed up with the example is fixed. Nobody was able to reproduce a hang, unfortunately.

I’m not really sure what to do with this, then.

My suspicion is that it might have been some kind of protocol desync between the edgedb server and the pgsql server, though I’m not really sure what. A lot of that machinery got reworked in 2.0

0reactions
haikyuucommented, Jun 24, 2022

Didn’t reproduce after either. Let’s close this and hopefully it won’t resurface again

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL query hangs without error (parallel subquery?)
You need to check what is actually happening while it is hanging. If you don't have any blocking monitoring set up, start by...
Read more >
Query hanging in ClientRead and blocking all others
The only way that such a session can block anything is if its state is idle in transaction . All locks are held...
Read more >
SSMS hangs for an extended period when closing a query tab ...
It seems as though it is trying to create a connection to the now unreachable server. I assume that this attempted connection eventually...
Read more >
Solved: Impala query hangs with No lease on error
Solved: Platform info: CDH 4.6.0 (without CM). Server version: impalad version 1.3.1-cdh4 RELEASE (build - 13014.
Read more >
query to server Neo4j instance hangs without any error #300
The process hangs there without any response, no error until we kill the process. It happens from time to time and when it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found