Repository navigation
MDEV-40839: SET members from the 9th on lost on a pushed-down SELECT - #5968
Open
GoldenEmperor1177 wants to merge 1 commit into
Open
GoldenEmperor1177 wants to merge 1 commit into
GoldenEmperor1177 wants to merge 1 commit into
Conversation
Type_handler_set::make_table_field() built the Field_set with get_enum_pack_length(), the ENUM rule (1 byte below 256 values), so a SET with more than 8 members got a 1-byte field in the temporary table of a select handler (used by the DuckDB engine and by FederatedX with federated_pushdown=1) and every member from the 9th on was cut off. Use get_set_pack_length(), as the other Type_handler_set functions already do. Tests: duckdb.set_wide_members and federated.federatedx_set_pushdown.
GoldenEmperor1177
force-pushed
the
MDEV-40839
branch
from
October 23, 2026 20:18
83585cc to
40b138c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MDEV-40839: SET column on ENGINE=DuckDB silently drops any member at ordinal position 9 or higher
Type_handler_set::make_table_field()built theField_setwithget_enum_pack_length(), the ENUM rule (1 byte below 256 values). A pushed-down SELECT (select handler) reads the result into a temporary table made through this function, so a SET with more than 8 members got a 1-byte field there and every member from the 9th on was cut off (a,icame back asa,ias an empty value). The stored data was always right, which is whyCAST(s AS CHAR),s='i',group_concat(s)andconcat(s,'')gave the correct result.The fix uses
get_set_pack_length(), as the otherType_handler_setfunctions (Column_definition_fix_attributes(),calc_key_length()) already do. Onlysql/sql_type.ccchanges, by one line; the DuckDB engine code is untouched. This path is only reached by engines that use a select handler. A plain InnoDB UNION or derived table turns the SET into a varchar and was never affected.Also reproduced with FederatedX (
federated_pushdown=1): a SET with more than 8 members loses members from the 9th on when read through the select handler, and reads correctly with the pushdown off. This shows the problem is in the core function and is not specific to DuckDB.Tests:
federated.federatedx_set_pushdown: without the fix the pushdown read loses members, with it it matches the remote table; also passes with--ps-protocoland--cursor-protocolduckdb.set_wide_members: fails without the fix (a / h / empty), passes with it; it also passes with--ps-protocoland--cursor-protocolmain.type_set,type_enum,union,derived,derived_cond_pushdown,func_set,ps,view,create_select,subselect,select,ctype_utf8mb4,cte_nonrecursivepassduckdb.create_table_columnandduckdb.feature_duckdb_data_typepass. Other tests of the suite fail on my machine only because of a time zone warning ("Can't find corresponding duckdb time_zone"), which happens without the change too.Base branch is 11.4, as agreed on the ticket.