[MDEV-31975]  UCASE(varchar_col)=... not handled for partition tables Created: 2023-08-21  Updated: 2023-08-24  Resolved: 2023-08-24

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.6
Fix Version/s: 11.3.0

Type: Bug Priority: Major
Reporter: Lena Startseva Assignee: Sergei Petrunia
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-31496 Make optimizer handle UCASE(varchar_c... Closed

 Description   

Expected that in partition table SELECT will be used "attached_condition": "t2.s1 = 'AA'" when " optimizer_switch='sargable_casefold=on'", but they still use "attached_condition": "ucase(t1.s1) = 'AA'":
Testcase:

-- source include/have_partition.inc
 
set
  @tmp_switch_sarg_casefold=@@optimizer_switch,
  optimizer_switch='sargable_casefold=on';
 
create table t1 (s1 varchar(15)) collate utf8mb3_general_ci partition by key (s1) ;
insert into t1 values ('aa'),('bb'),('0');
explain format=json select * from t1 where upper(s1)='AA';
 
drop table t1;
 
set optimizer_switch=@tmp_switch_sarg_casefold;

Actual result:

EXPLAIN
{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "t1",
      "partitions": ["p0"],
      "access_type": "ALL",
      "rows": 3,
      "filtered": 100,
      "attached_condition": "ucase(t1.s1) = 'AA'"
    }
  }
}



 Comments   
Comment by Lena Startseva [ 2023-08-23 ]

Ok to push

Comment by Sergei Petrunia [ 2023-08-24 ]

This fix is now a part of fix for MDEV-31496.

Generated at Thu Feb 08 10:27:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.