Database schema changed by macro, "no values modified error" got

After finding workaround on one of problems i got another. Database and macros are same as in Crash with macro on GridControl

The problem: If i change Category listed on left side of form ‘STATYSTYKA’ macro is fired and that macro drops table, creates new table with different schema, removes columns from gridcontrol, assigns new ones corresponding to new table and creates new sql statetement for form. But… something still thinks that column list was not changed, and if i modify any value on gridcontrol i got 'no values were modified" error. After no luck with many experiments i got an idea to actually define this table with all possible columns and if libreoffice wants big mostly empty tables than be it. But… i got some strange error when i was editing that table - in short it show me that table have for eg. column at1 and then complain that that column cannot be edited because column does not exists. And now the best: when i click ‘Edit table’ it shows table with columns id,at1,at2,at3 but if i ‘Open table’ it shows columns id,at6,at7,at8. So i assume that gridcontrol had shown columns at1,at2,at3, query was also set for that columns, but code which should prepare statement thought that columns are still at6,at7,at8 and because there was no change in them i got ‘no values were modified’ error.
So the question is: What i should do in macro after changing table schema to make LO actually know about it and update its internals with new schema?

I can drop using temp table if i could use sql statement with joins with gridcontrol and get that gridcontrol editable, but as soon as i use joins gridcontrol changes to read only, hence i’m using temp table filled with data from such statement and using macro to copy changed data back.