Skip to content

Binder Error: Cannot mix values of type FLOAT and UUID in BETWEEN clause - an explicit cast is required #4314

@fuzzerofducks

Description

@fuzzerofducks

Issue found by DuckFuzz on git commit hash 20696 using seed 528608682.

To Reproduce

create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types();
SELECT DISTINCT *, c44[lead((c21 BETWEEN c27 AND 'be5df8f1-82bc-4dec-baa3-78770b94569b')) OVER (ROWS BETWEEN c24 FOLLOWING AND UNBOUNDED FOLLOWING)], c25 FROM all_types AS t52(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51) WHERE c26 ORDER BY * NULLS FIRST;
SELECT DISTINCT c95, c14 FROM all_types AS t104(c53, c54, c55, c56, c57, c58, c59, c60, c61, c62, c63, c64, c65, c66, c67, c68, c69, c70, c71, c72, c73, c74, c75, c76, c77, c78, c79, c80, c81, c82, c83, c84, c85, c86, c87, c88, c89, c90, c91, c92, c93, c94, c95, c96, c97, c98, c99, c100, c101, c102, c103) WHERE c37 QUALIFY c54 USING SAMPLE 27% (System) ORDER BY * DESC NULLS LAST;
SELECT DISTINCT c60, c13, c25, rank_dense() OVER (PARTITION BY c140, c91 ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), #7 FROM all_types AS t156(c105, c106, c107, c108, c109, c110, c111, c112, c113, c114, c115, c116, c117, c118, c119, c120, c121, c122, c123, c124, c125, c126, c127, c128, c129, c130, c131, c132, c133, c134, c135, c136, c137, c138, c139, c140, c141, c142, c143, c144, c145, c146, c147, c148, c149, c150, c151, c152, c153, c154, c155) ORDER BY * ASC NULLS FIRST;
SELECT 6996, c12, c45, c32, c49, ntile('00:00:00'::TIME) OVER () FROM all_types AS t52(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51) HAVING c44 ORDER BY * DESC NULLS FIRST;
WITH t60 (c53, c54, c55, c56, c57, c58, c59) AS (SELECT DISTINCT *, *, c4, 1723, c33, (url_decode(2349) < (c46 BETWEEN c43 AND COALESCE(c18, c41, '071a8094-34e8-4aba-ae40-6eed5651a51e', c38, 1124, c26))), (c40 OR (c22 AND COALESCE(c37, *, #4, c46, nth_value(c35, has_table_privilege(c44, stddev(DISTINCT c24))) OVER (PARTITION BY 2018 ORDER BY c50 NULLS LAST, c14 NULLS FIRST RANGE BETWEEN 3577 PRECEDING AND CURRENT ROW), c31, c29, #7, c37)) OR c9), c44, c23 FROM all_types AS t52(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51) WHERE TRY_CAST(c25 AS UUID) GROUP BY c25, c29 ORDER BY *), t167 (c165, c166) AS ((SELECT DISTINCT NULL, NULL, 5656, c30, c68, ((* BETWEEN NULL AND c35) IS NULL), 9041, c23, c102 FROM all_types AS t112(c61, c62, c63, c64, c65, c66, c67, c68, c69, c70, c71, c72, c73, c74, c75, c76, c77, c78, c79, c80, c81, c82, c83, c84, c85, c86, c87, c88, c89, c90, c91, c92, c93, c94, c95, c96, c97, c98, c99, c100, c101, c102, c103, c104, c105, c106, c107, c108, c109, c110, c111) WHERE c70 GROUP BY ALL HAVING c40 ORDER BY * NULLS FIRST) UNION BY NAME (SELECT c81, c53, icu_collate_pt(c31) FROM all_types AS t164(c113, c114, c115, c116, c117, c118, c119, c120, c121, c122, c123, c124, c125, c126, c127, c128, c129, c130, c131, c132, c133, c134, c135, c136, c137, c138, c139, c140, c141, c142, c143, c144, c145, c146, c147, c148, c149, c150, c151, c152, c153, c154, c155, c156, c157, c158, c159, c160, c161, c162, c163) PIVOT (array_reverse_sort(t52.*), st_aswkb(TRY_CAST(list_position(c155, 8904) AS UINTEGER)) FOR (c93) IN (NULL, 4980) GROUP BY c139, c33, c67) WHERE 4143 GROUP BY c77 USING SAMPLE 18% (System) ORDER BY * DESC NULLS FIRST) ORDER BY * NULLS FIRST)SELECT c188, c159, c151, ((c102 BETWEEN #1 AND TRY_CAST(c108 AS UHUGEINT)) != c183), (ARRAY[5227, (c119 IS NULL)]), (c66 OR c69) FROM all_types AS t219(c168, c169, c170, c171, c172, c173, c174, c175, c176, c177, c178, c179, c180, c181, c182, c183, c184, c185, c186, c187, c188, c189, c190, c191, c192, c193, c194, c195, c196, c197, c198, c199, c200, c201, c202, c203, c204, c205, c206, c207, c208, c209, c210, c211, c212, c213, c214, c215, c216, c217, c218) WHERE (c140 >= has_table_privilege(c127, c147, #9)) HAVING (c130 IN (c190, c9, c57, ((lag(pg_ts_template_is_visible(*), c34) OVER (PARTITION BY 18446744073709551615 ROWS BETWEEN c42 PRECEDING AND ((c87 NOT IN (c212, ((c200 IS NOT DISTINCT FROM c37) OR c156), NULL, #6, c113, c106, c14)) BETWEEN c166 AND (c178 BETWEEN (NOT c78) AND c212)) FOLLOWING) > c114) IS DISTINCT FROM c213), CAST((lag(c193) OVER (RANGE BETWEEN c126 PRECEDING AND map_contains_entry(c148, c135, c131) FOLLOWING) != c25) AS INTEGER[]), c98, c88)) ORDER BY * NULLS LAST;
SELECT to_milliseconds(c240), (c122 BETWEEN CAST(((c216 AND (c268 NOT IN (#10, c169, c34, rank() OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), map_extract((c80 OR c241), c108), c205))) OR #1) AS STRUCT(a INTEGER, b VARCHAR)) AND *), 8249 FROM all_types AS t271(c220, c221, c222, c223, c224, c225, c226, c227, c228, c229, c230, c231, c232, c233, c234, c235, c236, c237, c238, c239, c240, c241, c242, c243, c244, c245, c246, c247, c248, c249, c250, c251, c252, c253, c254, c255, c256, c257, c258, c259, c260, c261, c262, c263, c264, c265, c266, c267, c268, c269, c270) WHERE c147 GROUP BY c51 HAVING c65 ORDER BY * ASC NULLS LAST;
DETACH DATABASE "temp";
WITH t328 (c324, c325, c326, c327) AS (SELECT c12, (((c183 OR 8416) NOT IN (c72, ([] AND c204), c172, c47, c66)) >= c13), #8, 8556, c25 FROM all_types AS t323(c272, c273, c274, c275, c276, c277, c278, c279, c280, c281, c282, c283, c284, c285, c286, c287, c288, c289, c290, c291, c292, c293, c294, c295, c296, c297, c298, c299, c300, c301, c302, c303, c304, c305, c306, c307, c308, c309, c310, c311, c312, c313, c314, c315, c316, c317, c318, c319, c320, c321, c322) WHERE (c18 OR c101) ORDER BY *)SELECT DISTINCT (c266 NOT IN (c173, c320, (ARRAY[#3]), c171, c139, c37)), c320, c256, c170, c232, c1, c199 FROM (VALUES (2696)) WHERE c135 GROUP BY c40 QUALIFY ((ARRAY['5b341cb7-25bf-4b7c-b606-141c307f16a4', ((c207 <= c188) OR ['a', NULL, 'c'])]) = c83) ORDER BY * ASC;
SELECT DISTINCT (NULL OR c95), c198, c72 WHERE c201 HAVING c149 QUALIFY c39 ORDER BY *;

Error Message

Binder Error: Cannot mix values of type FLOAT and UUID in BETWEEN clause - an explicit cast is required

Stack Trace

LINE 1: SELECT DISTINCT *, c44[lead((c21 BETWEEN c27 AND 'be5df8f1-82bc-4dec-baa3-78770b94569b')...
                                         ^
Binder Error: Referenced column "c37" not found in FROM clause!
Candidate bindings: "c57", "c67", "c77", "c87", "c97"

LINE 1: ..., c94, c95, c96, c97, c98, c99, c100, c101, c102, c103) WHERE c37 QUALIFY c54 USING SAMPLE 27% (System) ORDER BY * DESC...
                                                                         ^
Binder Error: Referenced column "c60" not found in FROM clause!
Candidate bindings: "c105", "c106", "c107", "c108", "c109"

LINE 1: SELECT DISTINCT c60, c13, c25, rank_dense() OVER (PARTITION BY c140, c91...
                        ^
Binder Error: column c44 must appear in the GROUP BY clause or be used in an aggregate function
ABORT THROWN BY INTERNAL EXCEPTION: Positional reference expression could not be bound

duckdb::StackTrace::GetStackTrace[abi:cxx11](unsigned long) 
duckdb::InternalException::InternalException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) 
duckdb::ExpressionBinder::BindPositionalReference(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::ExpressionBinder::BindExpression(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::MacroFunction::BindMacroFunction(duckdb::Binder&, duckdb::vector<duckdb::unique_ptr<duckdb::MacroFunction, std::default_delete<duckdb::MacroFunction>, true>, true, std::allocator<duckdb::unique_ptr<duckdb::MacroFunction, std::default_delete<duckdb::MacroFunction>, true> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, duckdb::FunctionExpression&, duckdb::vector<duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>, true, std::allocator<duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true> > >&, duckdb::InsertionOrderPreservingMap<duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true> >&, unsigned long) 
duckdb::ExpressionBinder::UnfoldMacroExpression(duckdb::FunctionExpression&, duckdb::ScalarMacroCatalogEntry&, duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long) 
duckdb::ExpressionBinder::BindMacro(duckdb::FunctionExpression&, duckdb::ScalarMacroCatalogEntry&, unsigned long, duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&) 
duckdb::ExpressionBinder::BindExpression(duckdb::FunctionExpression&, unsigned long, duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&) 
duckdb::ExpressionBinder::BindExpression(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::WhereBinder::BindExpression(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::ExpressionBinder::Bind(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::ExpressionBinder::BindChild(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, duckdb::ErrorData&) 
duckdb::ExpressionBinder::BindExpression(duckdb::ComparisonExpression&, unsigned long) 
duckdb::ExpressionBinder::BindExpression(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::WhereBinder::BindExpression(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::ExpressionBinder::Bind(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, unsigned long, bool) 
duckdb::ExpressionBinder::Bind(duckdb::unique_ptr<duckdb::ParsedExpression, std::default_delete<duckdb::ParsedExpression>, true>&, duckdb::optional_ptr<duckdb::LogicalType, true>, bool) 
duckdb::Binder::BindSelectNode(duckdb::SelectNode&, duckdb::BoundStatement) 
duckdb::Binder::BindNode(duckdb::SelectNode&) 
duckdb::Binder::BindNode(duckdb::QueryNode&) 
duckdb::Binder::Bind(duckdb::QueryNode&) 
duckdb::Binder::Bind(duckdb::SelectStatement&) 
duckdb::Binder::Bind(duckdb::SQLStatement&) 
duckdb::Planner::CreatePlan(duckdb::SQLStatement&) 
duckdb::Planner::CreatePlan(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>) 
duckdb::ClientContext::CreatePreparedStatementInternal(duckdb::ClientContextLock&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::PendingQueryParameters) 
duckdb::ClientContext::CreatePreparedStatement(duckdb::ClientContextLock&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::PendingQueryParameters, duckdb::PreparedStatementMode) 
duckdb::ClientContext::PendingStatementInternal(duckdb::ClientContextLock&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::PendingQueryParameters const&) 
duckdb::ClientContext::PendingStatementOrPreparedStatement(duckdb::ClientContextLock&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::shared_ptr<duckdb::PreparedStatementData, true>&, duckdb::PendingQueryParameters const&) 
duckdb::ClientContext::PendingStatementOrPreparedStatementInternal(duckdb::ClientContextLock&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::shared_ptr<duckdb::PreparedStatementData, true>&, duckdb::PendingQueryParameters const&) 
duckdb::ClientContext::PendingQueryInternal(duckdb::ClientContextLock&, duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::PendingQueryParameters const&, bool) 
duckdb::ClientContext::PendingQuery(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, duckdb::BoundParameterData, duckdb::CaseInsensitiveStringHashFunction, duckdb::CaseInsensitiveStringEquality, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, duckdb::BoundParameterData> > >&, duckdb::QueryParameters) 
duckdb::ClientContext::PendingQuery(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::QueryParameters) 
duckdb::ClientContext::Query(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::QueryParameters) 
duckdb::Connection::SendQuery(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, duckdb::QueryParameters) 
duckdb_shell::ShellState::ExecuteStatement(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>) 
duckdb_shell::ShellState::ExecuteSQL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) 
duckdb_shell::ShellState::RunOneSqlLine(duckdb_shell::InputMode, char*) 
duckdb_shell::ShellState::ProcessInput(duckdb_shell::InputMode) 
main 
_start

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