[MDEV-30770] Server stürzt bei Aufruf einer stored procedure, die einen select aufruft ab. Wenn der select direkt aufgerufen wird, geht es. Created: 2023-03-02  Updated: 2023-07-06  Resolved: 2023-07-06

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Procedure
Affects Version/s: 10.3.38
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Georg Getreuer Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: regression
Environment:

Debian



 Description   

Server stürzt bei Aufruf einer stored procedure, die einen select aufruft, ab. Wenn der select direkt aufgerufen wird, geht es. Bis gestern, vor dem update auf 10.3.38 in Debian 10 Buster, ging es.
Der select in der stored procedure ruft eine recht verschachtelte view auf. Kann es sein, dass durch den Aufruf per stored procedure gerade eine Ebene zu viel an Komplexität erreicht wird?

230302  8:12:02 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
 
Server version: 10.3.38-MariaDB-0+deb10u1-log source revision: c73985f2ce8a391582787f3e310a011c1a712bec
key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=7
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 352747 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7f91cc000c08
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7f923c4b3dd8 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55d7f4b9be2e]
/usr/sbin/mysqld(handle_fatal_signal+0x55d)[0x55d7f46c2cbd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f9256a2b730]
/usr/sbin/mysqld(_ZNK10Item_field11used_tablesEv+0x7)[0x55d7f46e6b87]
/usr/sbin/mysqld(_ZNK20Item_direct_view_ref11used_tablesEv+0x73)[0x55d7f46e6ff3]
/usr/sbin/mysqld(_ZN9Item_func18update_used_tablesEv+0x60)[0x55d7f44ac270]
/usr/sbin/mysqld(_ZN9Item_func18update_used_tablesEv+0x54)[0x55d7f44ac264]
/usr/sbin/mysqld(_ZN13st_select_lex18update_used_tablesEv+0x2dc)[0x55d7f44cc20c]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x7f)[0x55d7f453d08f]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55d7f453ddb7]
/usr/sbin/mysqld(_ZN18st_select_lex_unit8optimizeEv+0x30c)[0x55d7f4582b8c]
/usr/sbin/mysqld(_Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST+0x1a8)[0x55d7f44b31b8]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x8c)[0x55d7f44b29dc]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x72c)[0x55d7f453d73c]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55d7f453ddb7]
/usr/sbin/mysqld(_ZN18st_select_lex_unit8optimizeEv+0x30c)[0x55d7f4582b8c]
/usr/sbin/mysqld(_Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST+0x1a8)[0x55d7f44b31b8]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x8c)[0x55d7f44b29dc]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x72c)[0x55d7f453d73c]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55d7f453ddb7]
/usr/sbin/mysqld(_ZN18st_select_lex_unit8optimizeEv+0x30c)[0x55d7f4582b8c]
/usr/sbin/mysqld(_Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST+0x1a8)[0x55d7f44b31b8]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x8c)[0x55d7f44b29dc]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x72c)[0x55d7f453d73c]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55d7f453ddb7]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x7b3)[0x55d7f453fb83]
/usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x14d)[0x55d7f453fddd]
/usr/sbin/mysqld(+0x5c7a8c)[0x55d7f44dfa8c]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x5347)[0x55d7f44ec367]
/usr/sbin/mysqld(_ZN13sp_instr_stmt9exec_coreEP3THDPj+0x15)[0x55d7f4460a45]
/usr/sbin/mysqld(_ZN13sp_lex_keeper23reset_lex_and_exec_coreEP3THDPjbP8sp_instr+0xa2)[0x55d7f44675f2]
/usr/sbin/mysqld(_ZN13sp_instr_stmt7executeEP3THDPj+0x560)[0x55d7f4467f80]
/usr/sbin/mysqld(_ZN7sp_head7executeEP3THDb+0x82c)[0x55d7f44638bc]
/usr/sbin/mysqld(_ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE+0x93f)[0x55d7f4464d0f]
/usr/sbin/mysqld(+0x5c7425)[0x55d7f44df425]
/usr/sbin/mysqld(_ZN12Sql_cmd_call7executeEP3THD+0x166)[0x55d7f44e2126]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x2b29)[0x55d7f44e9b49]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1c9)[0x55d7f44eec49]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x111d)[0x55d7f44f0add]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x122)[0x55d7f44f2252]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x23a)[0x55d7f45c625a]
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x55d7f45c63dd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7fa3)[0x7f9256a20fa3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f925695206f]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f91cc1c25a0): SELECT * from `Abrechnung_Basis` a
 
Connection ID (thread ID): 37
Status: NOT_KILLED
 
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on
 
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             7859                 7859                 processes
Max open files            32768                32768                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7859                 7859                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us
Core pattern: core
 
Kernel version: Linux version 4.19.0-23-amd64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.269-1 (2022-12-20)
 
2023-03-02  8:12:07 0 [Note] Starting MariaDB 10.3.38-MariaDB-0+deb10u1-log source revision c73985f2ce8a391582787f3e310a011c1a712bec as process 5575
2023-03-02  8:12:07 0 [Note] Using unique option prefix 'myisam-recover' is error-prone and can break in the future. Please use the full name 'myisam-recover-options' instead.
2023-03-02  8:12:07 0 [Note] InnoDB: Using Linux native AIO
2023-03-02  8:12:07 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-03-02  8:12:07 0 [Note] InnoDB: Uses event mutexes
2023-03-02  8:12:07 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-03-02  8:12:07 0 [Note] InnoDB: Number of pools: 1
2023-03-02  8:12:07 0 [Note] InnoDB: Using SSE2 crc32 instructions
2023-03-02  8:12:07 0 [Note] InnoDB: Initializing buffer pool, total size = 384M, instances = 1, chunk size = 128M
2023-03-02  8:12:07 0 [Note] InnoDB: Completed initialization of buffer pool
2023-03-02  8:12:07 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-03-02  8:12:07 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=119361145319
2023-03-02  8:12:07 0 [Note] InnoDB: Starting final batch to recover 3 pages from redo log.
2023-03-02  8:12:08 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2023-03-02  8:12:08 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-03-02  8:12:08 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-03-02  8:12:08 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-03-02  8:12:08 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-03-02  8:12:08 0 [Note] InnoDB: Waiting for purge to start
2023-03-02  8:12:08 0 [Note] InnoDB: 10.3.38 started; log sequence number 119361145776; transaction id 98313874
2023-03-02  8:12:08 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-03-02  8:12:08 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-03-02  8:12:08 0 [Note] Recovering after a crash using tc.log
2023-03-02  8:12:08 0 [Note] Starting crash recovery...
2023-03-02  8:12:08 0 [Note] Crash recovery finished.
2023-03-02  8:12:08 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-03-02  8:12:08 0 [Note] Reading of all Master_info entries succeeded
2023-03-02  8:12:08 0 [Note] Added new Master_info '' to hash table
2023-03-02  8:12:08 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.38-MariaDB-0+deb10u1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Debian 10
2023-03-02  8:12:08 6 [Note] Event Scheduler: scheduler thread started with id 6
2023-03-02  8:12:08 0 [Note] InnoDB: Buffer pool(s) load completed at 230302  8:12:08



 Comments   
Comment by Daniel Black [ 2023-03-02 ]

I assume your previous good version was MariaDB-10.3.36 (from debian changelog).

After installing the debuginfo package, can you perform a gdb> bt full on the generated core and include the output here?

Can you include SHOW CREATE TABLE Abrechnung_Basis and samples of the view structure?

Is SELECT * from `Abrechnung_Basis` a the full query?

Can you show ANALYZE EXPLAIN FORMAT=JSON {query}?

The reason may not be complexity, just procedures like prepared statements are executed slightly differently.

EXECUTE IMMEDIATE "{query}" is likely to crash in the same way if you are up for experiementing to regain the coredump. You could attach gdb to mariadb before this to get an easier backtrace.

Comment by Georg Getreuer [ 2023-03-02 ]

Das Problem tritt mittlerweile auch bei einfachen select-Aufrufen auf. Allerdings nur vereinzelt, die meisten Abfragen funktionieren.

Comment by Georg Getreuer [ 2023-03-02 ]

Thanks for helping!
select * from Abrechnung_Basis works. It is call Formular_Abrechnung(..) that does not. In Formular_Abrechnung there are only 2 lines:
call setparam(..);
select * from Abrechnung_Basis. But the problem seems not to be related to this query, because the same occurs with others:

230302  8:53:40 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
 
Server version: 10.3.38-MariaDB-0+deb10u1-log source revision: c73985f2ce8a391582787f3e310a011c1a712bec
key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=6
max_threads=153
thread_count=9
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 352747 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7fb8e0000f38
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7fb93856cdd8 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55ad68d7de2e]
/usr/sbin/mysqld(handle_fatal_signal+0x55d)[0x55ad688a4cbd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7fb95313f730]
/usr/sbin/mysqld(_ZNK10Item_field11used_tablesEv+0x7)[0x55ad688c8b87]
/usr/sbin/mysqld(_ZNK20Item_direct_view_ref11used_tablesEv+0x73)[0x55ad688c8ff3]
/usr/sbin/mysqld(_ZN9Item_func18update_used_tablesEv+0x60)[0x55ad6868e270]
/usr/sbin/mysqld(_ZN9Item_func18update_used_tablesEv+0x54)[0x55ad6868e264]
/usr/sbin/mysqld(_ZN13st_select_lex18update_used_tablesEv+0x2dc)[0x55ad686ae20c]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x7f)[0x55ad6871f08f]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55ad6871fdb7]
/usr/sbin/mysqld(_ZN18st_select_lex_unit8optimizeEv+0x30c)[0x55ad68764b8c]
/usr/sbin/mysqld(_Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST+0x1a8)[0x55ad686951b8]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x8c)[0x55ad686949dc]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x72c)[0x55ad6871f73c]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55ad6871fdb7]
/usr/sbin/mysqld(_ZN18st_select_lex_unit8optimizeEv+0x30c)[0x55ad68764b8c]
/usr/sbin/mysqld(_Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST+0x1a8)[0x55ad686951b8]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x8c)[0x55ad686949dc]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x72c)[0x55ad6871f73c]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x37)[0x55ad6871fdb7]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x7b3)[0x55ad68721b83]
/usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x14d)[0x55ad68721ddd]
/usr/sbin/mysqld(+0x5c7a8c)[0x55ad686c1a8c]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x5347)[0x55ad686ce367]
/usr/sbin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x41e)[0x55ad686e32ee]
/usr/sbin/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0x97)[0x55ad686e34d7]
/usr/sbin/mysqld(+0x5ea3e5)[0x55ad686e43e5]
/usr/sbin/mysqld(_Z19mysqld_stmt_executeP3THDPcj+0x2b)[0x55ad686e44db]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x14ab)[0x55ad686d2e6b]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x122)[0x55ad686d4252]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x23a)[0x55ad687a825a]
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x55ad687a83dd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7fa3)[0x7fb953134fa3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7fb95306606f]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7fb8e000f9b0): SELECT `Id`, `BelegNr`, `Datum`, `Haus`, `Top`, `Konto`, `Bezeichnung`, `Subkonto`, `Text`, `Gegenkonto`, `Ein`, `UstEin`, `Aus`, `UstAus`, `Ust`, `keineUstbeiEntnahme`, `istAbrechnung` FROM JournalUst WHERE locate('Pölzl',Text)<>0
 
Connection ID (thread ID): 39
Status: NOT_KILLED
 
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on
 
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             7859                 7859                 processes
Max open files            32768                32768                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       7859                 7859                 signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us
Core pattern: core
 
Kernel version: Linux version 4.19.0-23-amd64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.269-1 (2022-12-20)
 
2023-03-02  8:53:46 0 [Note] Starting MariaDB 10.3.38-MariaDB-0+deb10u1-log source revision c73985f2ce8a391582787f3e310a011c1a712bec as process 6700
2023-03-02  8:53:46 0 [Note] Using unique option prefix 'myisam-recover' is error-prone and can break in the future. Please use the full name 'myisam-recover-options' instead.
2023-03-02  8:53:46 0 [Note] InnoDB: Using Linux native AIO
2023-03-02  8:53:46 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2023-03-02  8:53:46 0 [Note] InnoDB: Uses event mutexes
2023-03-02  8:53:46 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-03-02  8:53:46 0 [Note] InnoDB: Number of pools: 1
2023-03-02  8:53:46 0 [Note] InnoDB: Using SSE2 crc32 instructions
2023-03-02  8:53:46 0 [Note] InnoDB: Initializing buffer pool, total size = 384M, instances = 1, chunk size = 128M
2023-03-02  8:53:46 0 [Note] InnoDB: Completed initialization of buffer pool
2023-03-02  8:53:46 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2023-03-02  8:53:46 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=119378471254
2023-03-02  8:53:46 0 [Note] InnoDB: Starting final batch to recover 8 pages from redo log.
2023-03-02  8:53:46 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2023-03-02  8:53:46 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2023-03-02  8:53:46 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-03-02  8:53:46 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-03-02  8:53:46 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-03-02  8:53:46 0 [Note] InnoDB: Waiting for purge to start
2023-03-02  8:53:46 0 [Note] InnoDB: 10.3.38 started; log sequence number 119378481013; transaction id 98316343
2023-03-02  8:53:46 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2023-03-02  8:53:46 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-03-02  8:53:46 0 [Note] Recovering after a crash using tc.log
2023-03-02  8:53:46 0 [Note] Starting crash recovery...
2023-03-02  8:53:46 0 [Note] Crash recovery finished.
2023-03-02  8:53:46 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-03-02  8:53:46 6 [Note] Event Scheduler: scheduler thread started with id 6
2023-03-02  8:53:46 0 [Note] Reading of all Master_info entries succeeded
2023-03-02  8:53:46 0 [Note] Added new Master_info '' to hash table
2023-03-02  8:53:46 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.38-MariaDB-0+deb10u1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Debian 10
2023-03-02  8:53:46 0 [Note] InnoDB: Buffer pool(s) load completed at 230302  8:53:46

Comment by Georg Getreuer [ 2023-03-02 ]

sorry, but there is no mariadb-server-core-10.3-dbgsym:

root@lampe:/home/georg# apt-get install mariadb-server-core-10.3-dbgsym
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
E: Paket mariadb-server-core-10.3-dbgsym kann nicht gefunden werden.
E: Mittels des Musters »mariadb-server-core-10.3-dbgsym« konnte kein Paket gefunden werden.
E: Mittels regulärem Ausdruck »mariadb-server-core-10.3-dbgsym« konnte kein Paket gefunden werden.

Shall I provide anything else

Comment by Daniel Black [ 2023-03-02 ]

you might need a http://deb.debian.org/debian-debug/ repo line

Comment by Georg Getreuer [ 2023-03-02 ]

thank you, one step ahead, only one:

Die folgenden Pakete haben unerfüllte Abhängigkeiten:
mariadb-server-core-10.3-dbgsym : Hängt ab von: mariadb-server-core-10.3 (= 1:10.3.34-0+deb10u1) aber 1:10.3.38-0+deb10u1 soll installiert werden
E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.

Another strange behaviour is, that the first error (calling the procedure) occurs when called by PHP-PDO, command line and heidisql as well. The second error (calling the select ...) only happens when invoked by PHP-PDO. It runs perfectly (as it used to), when called by Heidi or command line

Comment by Alice Sherepa [ 2023-03-02 ]

Could you please add the output of SHOW CREATE VIEW Abrechnung_Basis and SHOW CREATE TABLE of involved tables or provide the test to demonstrate the problem?

Comment by Georg Getreuer [ 2023-03-02 ]

I can, but that is quite a lot. I have now upgraded to Debian 11, witch comes with Mariadb 10.5, That fixed the problem (but caused quite some new ones - not related to Mariadb)
Since another view caused the problem as well, and everything worked fine before the update to 10.3.38, I do not think the problem was related to the special query.

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `Abrechnung_Basis` AS select distinct 1 AS `reihe`,if(`gs`.`Haus` is null or `p`.`Top` = 0,`p`.`Top`,`s`.`Top`) AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Aufwendungen' AS `Text`,round(if(`p`.`Top` = 0 and `gs`.`Haus` is not null,0,sum(`jus`.`Ein` - `jus`.`Aus`)),2) AS `Betrag`,0 AS `ZW-Summe`,if(`gs`.`Haus` is null and `p`.`Top` = 0 or `k`.`zuSaldieren` = 0,0,coalesce(round(sum(`jus`.`Ein` - `jus`.`Aus`) * `a`.`Prozent`,2),0)) AS `IhrAnteil`,0 AS `IhrAnteil-ZWSumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b> Salden') AS `Ueberschrift` from (((((((`JournalUst` `jus` left join `Konten` `k` on(`jus`.`Haus` = `k`.`Haus` and `jus`.`Konto` = `k`.`Nummer`)) left join `Subkonten` `sk` on(`jus`.`Haus` = `sk`.`Haus` and `jus`.`Subkonto` = `sk`.`Nummer`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Zinsliste_Gschluessel_nurSchluessel` `gs` on(`gs`.`SchluesselDatumab` between concat(`p`.`Jahr`,'-12-31') and `aquartal`() and `gs`.`Nummer` = `jus`.`Konto`)) left join `Zinsliste_Gschluessel_nurSchluessel` `gsvj` on(`gsvj`.`Nummer` = `jus`.`Konto` and `p`.`Jahr` = year(`gsvj`.`SchluesselDatumab`))) left join `Zinsliste_Schluessel` `s` on(`jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) left join `Zinsliste_Schluessel_Anteil` `a` on(`a`.`Top` = `s`.`Top` and `a`.`Nummer` = `jus`.`Konto` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`a`.`SchluesselDatumab`,`a`.`SchluesselDatumbis`))) where (`jus`.`Haus` = `p`.`Haus` or `p`.`Haus` = 0) and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) and (convert(`jus`.`Datum` using utf8mb4) like convert(concat(`p`.`Jahr`,'%') using utf8mb4) or `p`.`Jahr` = 0) and `k`.`Abrechnung` <> 0 and (`jus`.`Text` <> 'Monatsvorschreibung' or `jus`.`istAbrechnung` <> 0 and `k`.`zuSaldieren` <> 0) and `k`.`istRuecklage` = 0 group by `jus`.`Konto`,`s`.`Top` having `Betrag` <> 0 or `IhrAnteil` <> 0 union select 1 AS `reihe`,`s`.`Top` AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,if(`jus`.`Ein` > 0,'Übertrag und Einnahmen','Ausgaben') AS `Text`,sum(`jus`.`Ein` - `jus`.`Aus`) AS `Betrag`,0 AS `Zwischensumme`,0 AS `IhrAnteil`,0 AS `IhrAnteil-ZWSumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b> Salden') AS `Ueberschrift` from ((((`JournalUst` `jus` left join `Konten` `k` on(`jus`.`Haus` = `k`.`Haus` and `jus`.`Konto` = `k`.`Nummer`)) left join `Subkonten` `sk` on(`jus`.`Haus` = `sk`.`Haus` and `jus`.`Subkonto` = `sk`.`Nummer`)) left join `Zinsliste_Schluessel` `s` on(`jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) left join `Parameter` `p` on(`p`.`connection` = connection_id())) where `p`.`Top` <> 0 and (`jus`.`Haus` = `p`.`Haus` or `p`.`Haus` = 0) and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) and (convert(`jus`.`Datum` using utf8mb4) like convert(concat(`p`.`Jahr`,'%') using utf8mb4) or `p`.`Jahr` = 0) and `k`.`Abrechnung` <> 0 and (`jus`.`Text`  not like '%bertrag' or `k`.`zuSaldieren` = 0) and (`jus`.`Text` <> 'Monatsvorschreibung' or `s`.`Schluessel` is null or `jus`.`istAbrechnung` <> 0 and `k`.`istRuecklage` <> 0) and `k`.`istRuecklage` <> 0 group by `jus`.`Konto`,`jus`.`Ein` - `jus`.`Aus` > 0 having `Betrag` <> 0 or `IhrAnteil` <> 0 union select 1 AS `reihe`,`a`.`Top` AS `Top`,`ea`.`BelegNr` AS `BelegNr`,`ea`.`Datum` AS `Datum`,`ea`.`Konto` AS `Konto`,`ea`.`istRuecklage` AS `istRuecklage`,`ea`.`Text` AS `TEXT`,if(`p`.`Top` = 0,0,`ea`.`Betrag`) AS `Betrag`,`ea`.`Zwischensumme` AS `Zwischensumme`,-round(`ea`.`Betrag` * `a`.`Prozent`,2) AS `ihrAnteil`,`ea`.`ihrAnteil-ZWsumme` AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,`ea`.`Ueberschrift` AS `Ueberschrift` from ((((select `v`.`Top` AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`v`.`Nummer` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Vorschreibung/Anteil zum Jahresende' AS `Text`,sum(`v`.`Vorschreibung`) AS `Betrag`,0 AS `Zwischensumme`,0 AS `ihrAnteil-ZWsumme`,concat('<b>',`k`.`Bezeichnung`,'</b>',' Salden') AS `Ueberschrift` from ((`Vorschreibungen` `v` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Konten` `k` on(`k`.`Haus` = `p`.`Haus` and `v`.`Nummer` = `k`.`Nummer`)) where `v`.`Haus` = `p`.`Haus` and year(`v`.`Datum`) = `p`.`Jahr` and `v`.`istAbrechnung` = 0 and `k`.`istRuecklage` <> 0) `ea` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Zinsliste_Schluessel_Anteil` `a` on(`a`.`Nummer` = `ea`.`Konto` and `inDatum`(concat(`p`.`Jahr`,'-12-31'),`a`.`SchluesselDatumab`,`a`.`SchluesselDatumbis`))) left join `Zinsliste_Top` `zt` on(`zt`.`Haus` = `p`.`Haus` and `zt`.`Top` = `p`.`Top`)) where `ea`.`istRuecklage` <> 0 and (`zt`.`istMiete` = 0 or `p`.`Top` = 0) union select distinct 2 AS `reihe`,if(`p`.`Top` = 0 and `gs`.`Haus` is null and `k`.`istRuecklage` = 0,0,coalesce(`s`.`Top`,0)) AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`v`.`Nummer` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,if(`k`.`istRuecklage`,'tatsächlich vorgeschrieben','Vorschreibung') AS `Text`,round(if(`k`.`istRuecklage` <> 0 or `p`.`Top` = 0 and `gs`.`Haus` is not null,0,sum(`v`.`Vorschreibung`)),2) AS `Betrag`,0 AS `Zwischensumme`,if(`k`.`istRuecklage` = 0 and ((`gsvj`.`Haus` is null or `gs`.`Haus` is null) and `p`.`Top` = 0 or `k`.`zuSaldieren` = 0 and `k`.`istRuecklage` = 0),0,sum(if(`v`.`Top` = `s`.`Top`,`v`.`Vorschreibung`,0))) AS `ihrAnteil`,0 AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b>',' Salden') AS `Ueberschrift` from (((((`Vorschreibungen` `v` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Konten` `k` on(`k`.`Haus` = `p`.`Haus` and `v`.`Nummer` = `k`.`Nummer`)) left join `Zinsliste_Gschluessel_nurSchluessel` `gs` on(`gs`.`SchluesselDatumab` between concat(`p`.`Jahr`,'-12-31') and `aquartal`() and `gs`.`Nummer` = `v`.`Nummer`)) left join `Zinsliste_Gschluessel_nurSchluessel` `gsvj` on(`gsvj`.`Nummer` = `v`.`Nummer` and `p`.`Jahr` = year(`gsvj`.`SchluesselDatumab`))) left join `Zinsliste_Schluessel` `s` on(`v`.`Haus` = `s`.`Haus` and `v`.`Nummer` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`v`.`Datum`),'-12-31'),`v`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) where `v`.`Haus` = `p`.`Haus` and year(`v`.`Datum`) = `p`.`Jahr` and (`v`.`istAbrechnung` = 0 or `k`.`zuSaldieren` = 0 and `k`.`istRuecklage` = 0) and `k`.`Abrechnung` <> 0 and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) group by `v`.`Nummer`,`s`.`Top` union select 2 AS `reihe`,if(`p`.`Top` = 0 and `gsvj`.`Haus` is null and `k`.`istRuecklage` = 0,0,coalesce(`s`.`Top`,0)) AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`v`.`Nummer` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Rechenausgleich' AS `Text`,0 AS `Betrag`,0 AS `Zwischensumme`,round(-sum(if(`v`.`Top` = `s`.`Top`,`v`.`Vorschreibung`,0)) + sum(`v`.`Vorschreibung`) * `a`.`Prozent`,2) AS `ihrAnteil`,0 AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b>',' Salden') AS `Ueberschrift` from ((((((`Vorschreibungen` `v` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Konten` `k` on(`k`.`Haus` = `p`.`Haus` and `v`.`Nummer` = `k`.`Nummer`)) left join `Zinsliste_Gschluessel_nurSchluessel` `gs` on(`gs`.`SchluesselDatumab` between concat(`p`.`Jahr`,'-12-31') and `aquartal`() and `gs`.`Nummer` = `v`.`Nummer`)) left join `Zinsliste_Gschluessel_nurSchluessel` `gsvj` on(`gsvj`.`Nummer` = `v`.`Nummer` and `p`.`Jahr` = year(`gsvj`.`SchluesselDatumab`))) left join `Zinsliste_Schluessel` `s` on(`v`.`Haus` = `s`.`Haus` and `v`.`Nummer` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`v`.`Datum`),'-12-31'),`v`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) left join `Zinsliste_Schluessel_Anteil` `a` on(`a`.`Nummer` = `v`.`Nummer` and `a`.`Top` = `s`.`Top` and `inDatum`(concat(`p`.`Jahr`,'-12-31'),`a`.`SchluesselDatumab`,`a`.`SchluesselDatumbis`))) where `v`.`Haus` = `p`.`Haus` and year(`v`.`Datum`) = `p`.`Jahr` and (`v`.`istAbrechnung` = 0 or `k`.`zuSaldieren` = 0 and `k`.`istRuecklage` = 0) and `k`.`Abrechnung` <> 0 and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) and (`k`.`istRuecklage` = 0 or `gsvj`.`Haus` is null) and (`p`.`Top` <> 0 or `k`.`istRuecklage` <> 0) group by `v`.`Nummer`,`s`.`Top` having `ihrAnteil` <> 0 union select 3 AS `reihe`,`p`.`Top` AS `Top`,`jus`.`BelegNr` AS `BelegNr`,concat(dayofmonth(`jus`.`Datum`),'.',month(`jus`.`Datum`),'.') AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,if(`jus`.`Text` like 'Monatsvorschreibung%' and `k`.`istRuecklage` <> 0,'Nachverrrechnung Ust',`jus`.`Text`) AS `Text`,`jus`.`Ein` - `jus`.`Aus` AS `Betrag`,if(`k`.`istRuecklage` = 0 and `jus`.`BelegNr` = last_value(`jus`.`BelegNr`) over ( partition by `jus`.`Text`,`jus`.`Konto`) and `jus`.`Datum` = last_value(`jus`.`Datum`) over ( partition by `jus`.`Text`,`jus`.`Konto`),sum(`jus`.`Ein` - `jus`.`Aus`) over ( partition by `jus`.`Text`,`jus`.`Konto`),0) AS `ZW-Summe`,round((`jus`.`Ein` - `jus`.`Aus`) * `a`.`Prozent`,2) AS `IhrAnteil`,if(`k`.`istRuecklage` = 0 and `jus`.`BelegNr` = last_value(`jus`.`BelegNr`) over ( partition by `jus`.`Text`,`jus`.`Konto`) and `jus`.`Datum` = last_value(`jus`.`Datum`) over ( partition by `jus`.`Text`,`jus`.`Konto`),round(sum(`jus`.`Ein` - `jus`.`Aus`) over ( partition by `jus`.`Text`,`jus`.`Konto`) * `a`.`Prozent`,2),0) AS `IhrAnteil-ZWSumme`,if(`k`.`AbrechnungWEG` <> 0 or `zsa`.`Top` is null,NULL,`a`.`Anteil`) AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b> Detail ',if(`s`.`Schluessel` is null,'',concat(if(`k`.`istRuecklage`,if(`jus`.`Ein` > 0,' Einnahmen ',' Ausgabe '),''),' (Ihr Anteil: ',`a`.`Anteil`,')'))) AS `Ueberschrift` from ((((((`JournalUst` `jus` left join `Konten` `k` on(`jus`.`Haus` = `k`.`Haus` and `jus`.`Konto` = `k`.`Nummer`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Subkonten` `sk` on(`jus`.`Haus` = `sk`.`Haus` and `jus`.`Subkonto` = `sk`.`Nummer`)) left join `Zinsliste_Schluessel` `s` on(`jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) left join `Zinsliste_Schluessel_Anteil` `a` on(`a`.`Nummer` = `jus`.`Konto` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`a`.`SchluesselDatumab`,`a`.`SchluesselDatumbis`))) left join `Zinsliste_Schluessel_Anteil` `zsa` on(`zsa`.`Nummer` = `jus`.`Konto` and year(`zsa`.`SchluesselDatumab`) = `p`.`Jahr`)) where `p`.`Top` <> 0 and (`jus`.`Haus` = `p`.`Haus` or `p`.`Haus` = 0) and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) and (convert(`jus`.`Datum` using utf8mb4) like convert(concat(`p`.`Jahr`,'%') using utf8mb4) or `p`.`Jahr` = 0) and `k`.`Abrechnung` <> 0 and (`jus`.`Text`  not like '%bertrag' or `k`.`zuSaldieren` = 0) and (`jus`.`Text` <> 'Monatsvorschreibung' or `s`.`Schluessel` is null or `jus`.`istAbrechnung` <> 0 and `k`.`istRuecklage` <> 0) and `jus`.`Text`  not like 'Ust Entnahme:%' union select 3 AS `reihe`,`p`.`Top` AS `Top`,NULL AS `BelegNr`,concat(dayofmonth(`jus`.`Datum`),'.',month(`jus`.`Datum`),'.') AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Abrechnungssaldo Vorjahr' AS `Text`,sum(`jus`.`Ein` - `jus`.`Aus`) AS `Betrag`,sum(`jus`.`Ein` - `jus`.`Aus`) AS `ZW-Summe`,round(sum(`jus`.`Ein` - `jus`.`Aus`) * `a`.`Prozent`,2) AS `IhrAnteil`,round(sum(`jus`.`Ein` - `jus`.`Aus`) * `a`.`Prozent`,2) AS `IhrAnteil-ZWSumme`,if(`k`.`AbrechnungWEG` <> 0 or `zsa`.`Top` is null,NULL,`a`.`Anteil`) AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b> Detail ',if(`s`.`Schluessel` is null,'',concat(if(`k`.`istRuecklage`,if(`jus`.`Ein` > 0,' Einnahmen ',' Ausgabe '),''),' (Ihr Anteil: ',`a`.`Anteil`,')'))) AS `Ueberschrift` from ((((((`JournalUst` `jus` left join `Konten` `k` on(`jus`.`Haus` = `k`.`Haus` and `jus`.`Konto` = `k`.`Nummer`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Subkonten` `sk` on(`jus`.`Haus` = `sk`.`Haus` and `jus`.`Subkonto` = `sk`.`Nummer`)) left join `Zinsliste_Schluessel` `s` on(`jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) left join `Zinsliste_Schluessel_Anteil` `a` on(`a`.`Nummer` = `jus`.`Konto` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`a`.`SchluesselDatumab`,`a`.`SchluesselDatumbis`))) left join `Zinsliste_Schluessel_Anteil` `zsa` on(`a`.`Nummer` = `jus`.`Konto` and year(`zsa`.`SchluesselDatumab`) = `p`.`Jahr` or year(`zsa`.`SchluesselDatumbis`) = `p`.`Jahr`)) where `p`.`Top` <> 0 and (`jus`.`Haus` = `p`.`Haus` or `p`.`Haus` = 0) and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) and (convert(`jus`.`Datum` using utf8mb4) like convert(concat(`p`.`Jahr`,'%') using utf8mb4) or `p`.`Jahr` = 0) and `k`.`Abrechnung` <> 0 and (`jus`.`Text` like '%bertrag' or `jus`.`Text` = 'Monatsvorschreibung' and `jus`.`istAbrechnung` <> 0) and `k`.`zuSaldieren` <> 0 group by `jus`.`Konto` having `Betrag` <> 0.01 union select 3 AS `reihe`,`p`.`Top` AS `Top`,NULL AS `BelegNr`,'31.12.' AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Ust, die bei Entnahme fällig wurde' AS `Text`,sum(`jus`.`Ein` - `jus`.`Aus`) AS `Betrag`,0 AS `ZW-Summe`,NULL AS `IhrAnteil`,0 AS `IhrAnteil-ZWSumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b> Detail ',if(`s`.`Schluessel` is null,'',concat(if(`k`.`istRuecklage`,if(`jus`.`Ein` > 0,' Einnahmen ',' Ausgabe '),''),' (Ihr Anteil: ',`a`.`Anteil`,')'))) AS `Ueberschrift` from (((((`JournalUst` `jus` left join `Konten` `k` on(`jus`.`Haus` = `k`.`Haus` and `jus`.`Konto` = `k`.`Nummer`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Subkonten` `sk` on(`jus`.`Haus` = `sk`.`Haus` and `jus`.`Subkonto` = `sk`.`Nummer`)) left join `Zinsliste_Schluessel` `s` on(`jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) left join `Zinsliste_Schluessel_Anteil` `a` on(`a`.`Nummer` = `jus`.`Konto` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`a`.`SchluesselDatumab`,`a`.`SchluesselDatumbis`))) where `p`.`Top` <> 0 and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0 or `s`.`Top` is null) and (convert(`jus`.`Datum` using utf8mb4) like convert(concat(`p`.`Jahr`,'%') using utf8mb4) or `p`.`Jahr` = 0) and `k`.`Abrechnung` <> 0 and (`jus`.`istAbrechnung` <> 1 or `jus`.`istAbrechnung` is null) and `jus`.`Text` like 'Ust Entnahme:%' having `Betrag` <> 0 union select 4 AS `reihe`,`p`.`Top` AS `Top`,NULL AS `BelegNr`,concat(dayofmonth(`v`.`Datum`),'.',month(`v`.`Datum`),'.') AS `Datum`,`v`.`Nummer` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Vorschreibung' AS `Text`,if(`sg`.`Haus` is null,sum(`v`.`Vorschreibung`),0) AS `Betrag`,0 AS `Zwischensumme`,sum(if(`v`.`Top` = `p`.`Top` or `sg`.`Haus` is not null,`v`.`Vorschreibung`,0)) AS `ihrAnteil`,0 AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b>',' Vorschreibungen') AS `Ueberschrift` from (((`Vorschreibungen` `v` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Konten` `k` on(`k`.`Haus` = `p`.`Haus` and `v`.`Nummer` = `k`.`Nummer`)) left join `Zinsliste_Gschluessel_nurSchluessel` `sg` on(`p`.`Top` = 0 and `sg`.`Haus` = `p`.`Haus` and `sg`.`Nummer` = `v`.`Nummer` and `k`.`AbrechnungWEG` <> 0 and `k`.`zuSaldieren` <> 0 and year(`sg`.`SchluesselDatumab`) = `p`.`Jahr`)) where `v`.`Haus` = `p`.`Haus` and year(`v`.`Datum`) = `p`.`Jahr` and (`v`.`istAbrechnung` = 0 or `k`.`zuSaldieren` = 0) and `k`.`istRuecklage` = 0 and `k`.`Abrechnung` <> 0 and `p`.`Top` <> 0 group by `v`.`Nummer`,`v`.`Datum` having `ihrAnteil` <> 0 or `Top` is null union select 4 AS `reihe`,if(`p`.`Top` = 0,`v`.`Top`,`p`.`Top`) AS `Top`,NULL AS `BelegNr`,concat(dayofmonth(`v`.`Datum`),'.',month(`v`.`Datum`),'.') AS `Datum`,`v`.`Nummer` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'Vorschreibung' AS `Text`,sum(`v`.`Vorschreibung`) AS `Betrag`,0 AS `Zwischensumme`,sum(if(`v`.`Top` = `p`.`Top` and `p`.`Top` <> 0,`v`.`Vorschreibung`,0)) AS `ihrAnteil`,NULL AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,concat('<b>',`k`.`Bezeichnung`,'</b>',' Vorschreibungen') AS `Ueberschrift` from ((`Vorschreibungen` `v` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Konten` `k` on(`k`.`Haus` = `p`.`Haus` and `v`.`Nummer` = `k`.`Nummer`)) where `v`.`Haus` = `p`.`Haus` and year(`v`.`Datum`) = `p`.`Jahr` and `v`.`istAbrechnung` = 0 and `k`.`istRuecklage` <> 0 and `p`.`Top` <> 0 group by `v`.`Nummer`,`v`.`Datum` having `ihrAnteil` > 0 union select 6 AS `reihe`,`s`.`Top` AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,concat(`s`.`Ust`,'%',' Ust aus Ihrem Anteil an der Entnahme') AS `TEXT`,0 AS `Betrag`,NULL AS `Zwischensumme`,-round(sum(`jus`.`Aus`) * `s`.`Ust` / 100 * `s`.`Schluessel` / (select sum(`s`.`Schluessel`) from `Zinsliste_Schluessel` `s` where `jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`)),2) AS `IhrAnteil`,NULL AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,'Verrechnung der Ust, die bei Entnahme aus der Rücklage fällig wurde' AS `Ueberschrift` from (((`Zinsliste_Schluessel` `s` left join `Konten` `k` on(`s`.`Haus` = `k`.`Haus` and `s`.`Nummer` = `k`.`Nummer`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `JournalUst` `jus` on(`jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(`jus`.`Datum`,`s`.`Datumab`,`s`.`Datumbis`))) where `k`.`istRuecklage` <> 0 and `jus`.`Aus` > 0 and `jus`.`keineUstbeiEntnahme` = 0 and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0) and `jus`.`Text`  not like 'Ust Entnahme%' group by `s`.`Top` union select 7 AS `reihe`,`s`.`Top` AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,`jus`.`Konto` AS `Konto`,`k`.`istRuecklage` AS `istRuecklage`,'davon aus der Rücklage entnommen' AS `TEXT`,0 AS `Betrag`,NULL AS `Zwischensumme`,round(sum(`jus`.`Aus`) * `s`.`Schluessel` / (select sum(`s`.`Schluessel`) from `Zinsliste_Schluessel` `s` where `jus`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`)) * (select min(`s`.`Ust`) from `Zinsliste_Schluessel` `s` where `p`.`Haus` = `s`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`)) / 100,2) AS `IhrAnteil`,NULL AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,'Verrechnung der Ust, die bei Entnahme aus der Rücklage fällig wurde' AS `Ueberschrift` from (((`Zinsliste_Schluessel` `s` left join `Konten` `k` on(`s`.`Haus` = `k`.`Haus` and `s`.`Nummer` = `k`.`Nummer`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `JournalUst` `jus` on(`p`.`Haus` = `jus`.`Haus` and `jus`.`Konto` = `s`.`Nummer` and `inDatum`(if(`k`.`AbrechnungWEG`,concat(year(`jus`.`Datum`),'-12-31'),`jus`.`Datum`),`s`.`Datumab`,`s`.`Datumbis`))) where `k`.`istRuecklage` <> 0 and `jus`.`Aus` > 0 and `jus`.`keineUstbeiEntnahme` = 0 and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0) and `s`.`Haus` = `p`.`Haus` and `jus`.`Text`  not like 'Ust Entnahme%' group by `s`.`Top` union select 8 AS `Reihe`,NULL AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,NULL AS `Konto`,0 AS `istRuecklage`,concat('Top Nr ',`z`.`top`) AS `Text`,sum(`z`.`Betrag`) AS `Betrag`,NULL AS `Zwischensumme`,NULL AS `IhrAnteil`,NULL AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,'Rückstände der Wohnungseigentümer' AS `Ueberschrift` from (((((select `t`.`Haus` AS `Haus`,`t`.`Top` AS `top`,sum(`j`.`Aus` - `j`.`Ein`) AS `Betrag` from ((`Zinsliste_Top` `t` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Journal` `j` on(`j`.`Haus` = `p`.`Haus` and `j`.`Top` = `t`.`Top` and `j`.`Datum` <= concat(`p`.`Jahr`,'-12-31'))) where `t`.`Haus` = `p`.`Haus` group by `t`.`Top`) union select `t`.`Haus` AS `Haus`,`t`.`Top` AS `top`,sum(`v`.`Vorschreibung` + `v`.`Ust`) AS `Betrag` from ((`Zinsliste_Top` `t` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Vorschreibungen` `v` on(`v`.`Haus` = `t`.`Haus` and `v`.`Top` = `t`.`Top` and `v`.`Datum` <= concat(`p`.`Jahr`,'-12-31'))) where `p`.`Haus` = `v`.`Haus` group by `t`.`Top`) `z` left join `Haus` `h` on(`h`.`Nummer` = `z`.`Haus`)) left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `Zinsliste_Top` `zt` on(`z`.`Haus` = `zt`.`Haus` and `p`.`Top` = `zt`.`Top`)) where `h`.`MietEigentum` = 'e' and `zt`.`istMiete` = 0 group by `z`.`top` having `Betrag` > 0 union select 9 AS `reihe`,`s`.`Top` AS `Top`,NULL AS `BelegNr`,NULL AS `Datum`,NULL AS `Konto`,0 AS `istRuecklage`,`se`.`Beschreibung` AS `TEXT`,`se`.`Betrag` AS `Betrag`,NULL AS `Zwischensumme`,round(`se`.`Betrag` * `s`.`Schluessel` / (select sum(`s`.`Schluessel`) from `Zinsliste_Schluessel` `s` where `p`.`Haus` = `s`.`Haus` and `k`.`Nummer` = `s`.`Nummer` and `inDatum`(concat(`p`.`Jahr`,'-12-31'),`s`.`Datumab`,`s`.`Datumbis`)),2) AS `IhrAnteil`,NULL AS `ihrAnteil-ZWsumme`,NULL AS `Anteil`,'Einkünfte der Eigentumsgemeinschaft' AS `Ueberschrift` from (((`Zinsliste_Schluessel` `s` left join `Parameter` `p` on(`p`.`connection` = connection_id())) left join `HausSteuerEinkunft` `se` on(`p`.`Haus` = `se`.`Haus` and `p`.`Jahr` = `se`.`Jahr`)) left join `Konten` `k` on(`p`.`Haus` = `k`.`Haus` and `k`.`istRuecklage` <> 0)) where `se`.`Betrag` <> 0 and (`s`.`Top` = `p`.`Top` or `p`.`Top` = 0) and `s`.`Haus` = `p`.`Haus` group by `s`.`Top` order by `reihe` < 3 desc,`reihe` > 7,`istRuecklage`,`Top` desc,`Konto`,`reihe`,`Text`  not like '%bertrag',sign(coalesce(`Betrag`,`ZW-Summe`)) desc,`Text` like 'Ust, die%',if(`istRuecklage`,'',`Text`),`Betrag` > 0,`BelegNr`

Comment by Daniel Black [ 2023-07-06 ]

Thank for confirming the 10.5 fix.

Comment by Daniel Black [ 2023-07-06 ]

marking as won't fix in 10.3 because its EOL

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