Bug #110032 Query Plan Generation Error NoneType object has no attribute set_attributes
Submitted: 10 Feb 2023 17:18 Modified: 15 Feb 2023 12:15
Reporter: David Saez Padros Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.32 OS:Windows (11)
Assigned to: CPU Architecture:x86

[10 Feb 2023 17:18] David Saez Padros
Description:
query is

SELECT fam_parent AS project_fam_parent,
       SUM(fam_instances) AS instances_total,
       ROUND(SUM(IF(fam_changes=0, fam_instances, 0)) * 100 / SUM(fam_instances)) AS instances_original,
       ROUND(SUM(IF(fam_changes & 25, 1, 0)) / COUNT(DISTINCT fam_library) * 100 ) AS fam_modified_perc,
       COUNT(DISTINCT fam_library) AS instances_models,
       COUNT(DISTINCT cli_collection) AS instances_projects
FROM ifm_families
INNER JOIN ifm_libraries ON fam_library = lib_link
LEFT JOIN ifm_colitems ON cli_library = lib_id
WHERE lib_account = '2'
	AND (
		(lib_type != 'Collection' AND (lib_private = 0 OR lib_private IS NULL))
        OR (lib_id IN (SELECT lua_lib FROM ifm_libaccess WHERE lua_user = 2097))
        OR (lib_id IN (SELECT cli_library FROM ifm_colitems WHERE cli_collection IN 
		    (SELECT DISTINCT(lua_collection) FROM ifm_libaccess WHERE lua_user = 2097)) AND 1)
	    OR (lib_type = 'Collection' AND lib_private = 0 AND lib_user_modify = 1)	
		OR (lib_type = 'Collection' AND (
			(lib_owner = 2097 AND lib_readonly = 0 AND lib_is_user = 1)
			OR (lib_id IN (SELECT shr_library_dest FROM ifm_shares WHERE shr_user_dest = 2097 AND shr_accepted))
			OR (lib_is_user = 0 AND lib_private = 0)
			)
		)) AND lib_archived = 0 AND fam_archived = 0 AND lib_archived = 0 AND lib_account = '2' AND fam_parent != 0 AND lib_type = 'Model'
GROUP BY project_fam_parent

Result from explain is:

# id, select_type, table, partitions, type, possible_keys, key, key_len, ref, rows, filtered, Extra
1, PRIMARY, ifm_families, , range, xmllist,fam_index,parent, parent, 5, , 971841, 10.00, Using index condition; Using where
1, PRIMARY, ifm_libraries, , ref, central,unc_account,acount_number,lib_link,instances, lib_link, 5, kinship.ifm_families.fam_library, 1, 3.74, Using where
1, PRIMARY, ifm_colitems, , ref, single_model, single_model, 4, kinship.ifm_libraries.lib_id, 1, 100.00, Using where; Using index
5, SUBQUERY, ifm_shares, , ref, shr_user_dest, shr_user_dest, 5, const, 1, 90.00, Using where
3, SUBQUERY, <subquery4>, , ALL, , , , , , 100.00, Using where
3, SUBQUERY, ifm_colitems, , ref, PRIMARY,single_model, PRIMARY, 4, <subquery4>.lua_collection, 4, 100.00, Using where; Using index
4, MATERIALIZED, ifm_libaccess, , ref, PRIMARY,lua_collection, PRIMARY, 4, const, 43, 100.00, 
2, SUBQUERY, ifm_libaccess, , ref, PRIMARY, PRIMARY, 4, const, 43, 100.00, Using index

How to repeat:
Using Explain current statment
[13 Feb 2023 13:11] MySQL Verification Team
Hello David,

Thank you for the bug report.
Could you please provide table structure for all the tables used in above query along with exact error?

Regards,
Ashwini Patil
[14 Feb 2023 7:06] David Saez Padros
Error message

Attachment: error.png (image/png, text), 322.61 KiB.

[14 Feb 2023 7:07] David Saez Padros
SQL structure

Attachment: ifm.sql (application/octet-stream, text), 9.48 KiB.

[14 Feb 2023 7:08] David Saez Padros
Files attached!
[15 Feb 2023 12:05] MySQL Verification Team
Hello David,

Thank you for the details.
I tried to reproduce your issue on windows 10 with workbench 8.0.32 using sql file and select query provided but I am not seeing any issues at my end.

Regards,
Ashwini Patil
[15 Feb 2023 12:15] David Saez Padros
Try to fill your tables with hundreds of thousand records