Something went wrong. Try again.
SQL frontend over the catalog engine
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190open Query_part_1open Query_part_2
let suite = ( "query", [ Alcotest.test_case "an enclosing value is no ordinal" `Quick test_an_enclosing_value_is_no_ordinal; Alcotest.test_case "scan / filter / project / order" `Quick test_select; Alcotest.test_case "OR factors its common terms" `Quick test_factor_disjunctions; Alcotest.test_case "numeric literal forms (5. and .5)" `Quick test_numeric_literal_forms; Alcotest.test_case "arithmetic NaN is NULL" `Quick test_arithmetic_nan_is_null; Alcotest.test_case "inner join" `Quick test_join; Alcotest.test_case "recursive CTE" `Quick test_recursive_cte; Alcotest.test_case "compound UNION" `Quick test_compound; Alcotest.test_case "unknown column fails" `Quick test_unknown_column; Alcotest.test_case "GROUP BY resolves a select-list alias" `Quick test_group_by_alias; Alcotest.test_case "GROUP BY prefers an input column to an alias" `Quick test_group_by_alias_shadowed_by_column; Alcotest.test_case "ORDER BY prefers an alias to an input column" `Quick test_order_by_alias_beats_column; Alcotest.test_case "an alias reaches a subquery body" `Quick test_an_alias_reaches_a_subquery_body; Alcotest.test_case "GROUP BY on an unknown name fails" `Quick test_group_by_unknown_name; Alcotest.test_case "a declared COLLATE reaches every comparison" `Quick test_declared_collation; Alcotest.test_case "a declared COLLATE ignores identifier case" `Quick test_declared_collation_ignores_identifier_case; Alcotest.test_case "rowid needs a relation that has one" `Quick test_rowid_needs_a_relation_with_one; Alcotest.test_case "hoisting reads names as identifiers" `Quick test_hoisting_reads_names_as_identifiers; Alcotest.test_case "a CTE defined in terms of itself" `Quick test_cte_defined_in_terms_of_itself; Alcotest.test_case "a nested WITH shadows rather than cycles" `Quick test_nested_with_shadows_rather_than_cycles; Alcotest.test_case "an unread nested WITH is never expanded" `Quick test_an_unread_nested_with_is_never_expanded; Alcotest.test_case "a shadowed reference is not this relation" `Quick test_a_shadowed_reference_is_not_this_relation; Alcotest.test_case "a WITH scopes over every arm" `Quick test_a_with_scopes_over_every_arm; Alcotest.test_case "a WITH placement the grammar refuses" `Quick test_a_with_placement_the_grammar_refuses; Alcotest.test_case "the whole WITH list is in scope for each member" `Quick test_the_whole_with_list_is_in_scope; Alcotest.test_case "a cycle names where it was entered" `Quick test_a_cycle_names_where_it_was_entered; Alcotest.test_case "a CAST of a column keeps its COLLATE" `Quick test_declared_collation_through_cast; Alcotest.test_case "a CAST of a column sorts under its COLLATE" `Quick test_declared_collation_orders_through_cast; Alcotest.test_case "unary + keeps the operand's COLLATE" `Quick test_unary_plus_keeps_collation; Alcotest.test_case "unary + strips the operand's affinity" `Quick test_unary_plus_strips_affinity; Alcotest.test_case "an explicit COLLATE below the top node counts" `Quick test_explicit_collation_below_the_top_node; Alcotest.test_case "an explicit COLLATE in any subexpression counts" `Quick test_explicit_collation_in_any_subexpression; Alcotest.test_case "a sort or group key counts one too" `Quick test_explicit_collation_in_any_subexpression_of_a_key; Alcotest.test_case "a DISTINCT sequence is indexed by projected column" `Quick test_a_distinct_collation_is_indexed_by_projected_column; Alcotest.test_case "a single constant IN element is an equality" `Quick test_a_single_constant_element_in_is_an_equality; Alcotest.test_case "an explicit COLLATE outranks a declared one" `Quick test_explicit_collation_outranks_a_declared_one; Alcotest.test_case "a single-use CTE is spliced into its reader" `Quick test_flatten_single_use; Alcotest.test_case "flattening ANDs the body's predicate in" `Quick test_flatten_merges_predicates; Alcotest.test_case "flattening keeps the CTE's column list" `Quick test_flatten_star_keeps_the_cte_columns; Alcotest.test_case "a multi-use CTE stays materialised" `Quick test_no_flatten_multi_use; Alcotest.test_case "a CTE a reader cannot take stays whole" `Quick test_no_flatten_beside_a_reader_it_cannot_take; Alcotest.test_case "the body constraints refuse flattening" `Quick test_no_flatten_body_constraints; Alcotest.test_case "a recursive CTE stays materialised" `Quick test_no_flatten_recursive; Alcotest.test_case "a chain of single-use CTEs collapses" `Quick test_flatten_chained_ctes; Alcotest.test_case "a CTE in inner-join position is spliced" `Quick test_flatten_inner_join_operand; Alcotest.test_case "a LEFT JOIN operand's predicate moves to the ON" `Quick test_flatten_left_join_operand; Alcotest.test_case "a RIGHT or FULL join refuses flattening" `Quick test_no_flatten_right_or_full_join; Alcotest.test_case "a DISTINCT reader over a LEFT JOIN refuses" `Quick test_no_flatten_distinct_over_left_join; Alcotest.test_case "a narrowing CTE refuses NATURAL / USING" `Quick test_no_flatten_natural_when_narrowing; Alcotest.test_case "a narrowing CTE flattens into a joining reader" `Quick test_flatten_narrowing_cte_with_join; Alcotest.test_case "a name the widened alias would capture refuses" `Quick test_no_flatten_captured_name; Alcotest.test_case "a rowid read through the alias refuses" `Quick test_no_flatten_rowid_read; Alcotest.test_case "a column the CTE hid stays hidden" `Quick test_no_flatten_hidden_column; Alcotest.test_case "a body the reader reads is resolved" `Quick test_a_read_cte_body_is_resolved; Alcotest.test_case "a body over a sibling CTE is resolved" `Quick test_a_body_over_a_sibling_cte_is_resolved; Alcotest.test_case "flattening keeps parameter indices" `Quick test_flatten_keeps_parameter_indices; Alcotest.test_case "a join splice keeps parameter indices" `Quick test_flatten_join_keeps_parameter_indices; Alcotest.test_case "explain is the plan the engine runs" `Quick test_explain_is_the_executed_plan; Alcotest.test_case "explain renders the path the catalog names" `Quick test_explain_renders_the_path_the_catalog_names; Alcotest.test_case "explain scans for a rowid read" `Quick test_explain_a_rowid_read_scans; Alcotest.test_case "a constant subquery keys a seek" `Quick test_explain_a_constant_subquery_seeks; Alcotest.test_case "explain lists sources in FROM order" `Quick test_explain_lists_sources_in_from_order; Alcotest.test_case "a joined source seeks" `Quick test_a_joined_source_seeks; Alcotest.test_case "a seek key ignores identifier case" `Quick test_a_seek_key_ignores_identifier_case; Alcotest.test_case "a pin reaches the other end of the join key" `Quick test_a_pin_reaches_the_other_end_of_the_join_key; Alcotest.test_case "explain scans a materialised CTE" `Quick test_explain_scans_a_materialised_cte; Alcotest.test_case "plan_sources binds the statement's own CTEs" `Quick test_plan_sources_binds_the_statements_own_ctes; Alcotest.test_case "explain resolves before it describes" `Quick test_explain_resolves_before_it_describes; Alcotest.test_case "explain describes what resolves" `Quick test_explain_describes_what_resolves; Alcotest.test_case "chain: LEFT then LEFT" `Quick test_chain_left_left; Alcotest.test_case "chain: inner then RIGHT" `Quick test_chain_inner_right; Alcotest.test_case "chain: LEFT then FULL" `Quick test_chain_left_full; Alcotest.test_case "chain: GROUP BY over the null-fills" `Quick test_chain_group_by; Alcotest.test_case "chain: an ON naming a later table" `Quick test_chain_on_names_a_later_table; Alcotest.test_case "chain: a window over an inner chain" `Quick test_window_over_an_inner_chain; Alcotest.test_case "NATURAL over three sources" `Quick test_natural_join_of_three; Alcotest.test_case "USING over three sources" `Quick test_using_join_of_three; Alcotest.test_case "NATURAL LEFT over three sources" `Quick test_natural_left_join_of_three; Alcotest.test_case "a grouped star publishes the join's columns" `Quick test_a_grouped_star_publishes_the_joins_columns; Alcotest.test_case "a NATURAL join with nothing in common" `Quick test_a_natural_join_with_nothing_in_common_crosses; Alcotest.test_case "a USING column one operand has not got" `Quick test_a_using_column_absent_from_an_operand; Alcotest.test_case "the column a RIGHT join's USING preserves" `Quick test_using_column_a_right_join_preserves; Alcotest.test_case "the column a FULL join's USING preserves" `Quick test_using_column_a_full_join_preserves; Alcotest.test_case "a recursive LIMIT bounds the table" `Quick test_a_recursive_limit_bounds_the_table; Alcotest.test_case "a recursive OFFSET drops from the front" `Quick test_a_recursive_offset_drops_from_the_front; Alcotest.test_case "a recursive UNION dedups across the rounds" `Quick test_a_recursive_union_dedups_across_the_rounds; Alcotest.test_case "a qualified name skips a source without it" `Quick test_a_qualified_name_skips_a_source_without_it; Alcotest.test_case "EXCEPT and INTERSECT over duplicates" `Quick test_except_and_intersect_over_duplicates; Alcotest.test_case "an enclosing aggregate in a subquery clause" `Quick test_an_enclosing_aggregate_in_a_subquery_clause; Alcotest.test_case "a bounded recursion costs what it produces" `Quick test_a_bounded_recursion_costs_what_it_produces; Alcotest.test_case "a recursion is bounded past a million rows" `Quick test_a_recursion_is_bounded_past_a_million_rows; Alcotest.test_case "an unbounded recursion is refused at the cap" `Quick test_an_unbounded_recursion_is_refused_at_the_cap; Alcotest.test_case "a LIMIT is an expression" `Quick test_a_limit_is_an_expression; Alcotest.test_case "ORDER BY in a recursive select is refused" `Quick test_order_by_in_a_recursive_select_is_refused; Alcotest.test_case "reads_table looks through a view" `Quick test_reads_table_through_a_view; ] )