```
avtokmakov-dev.sas.yp-c.yandex.net :) create function f as x -> 1;
avtokmakov-dev.sas.yp-c.yandex.net :) create function g as x -> f(x);
avtokmakov-dev.sas.yp-c.yandex.net :) create or replace function f as x -> g(x);

avtokmakov-dev.sas.yp-c.yandex.net :) select f(1)

SELECT f(1)

Query id: d73ee45a-36db-4809-bc4b-639298cbfdbb

[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.130658 [ 25999 ] <Fatal> BaseDaemon: ########################################
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.130878 [ 25999 ] <Fatal> BaseDaemon: (version 21.11.1.8600 (official build), build id: 179ACA2B3FAC7AE9A7438EA7C9D1C0BCE98E392F) (from thread 25440) (query_id: d73ee45a-36db-4809-bc4b-639298cbfdbb) Received signal Segmentation fault (11)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.131015 [ 25999 ] <Fatal> BaseDaemon: Address: 0x7fec1fbfff70 Access: write. Attempted access has violated the permissions assigned to the memory area.
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.131147 [ 25999 ] <Fatal> BaseDaemon: Stack trace: 0x98d4549 0x98d49c9 0x135a648b 0x135aae61 0x135ad778 0x135a7ee8 0x135a910d 0x1359fc8e 0x1359f819 0x135f1476 0x13584a9e 0x9895683 0x11c4f036 0x11c4ef8c 0x1110ef69 0x1110e963 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0 0x1110e9c0
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.135244 [ 25999 ] <Fatal> BaseDaemon: 3. /build/build_docker/../src/Common/ThreadFuzzer.cpp:190: DB::injection(double, double, double, double) @ 0x98d4549 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.138881 [ 25999 ] <Fatal> BaseDaemon: 4. /build/build_docker/../src/Common/ThreadFuzzer.cpp:293: pthread_mutex_unlock @ 0x98d49c9 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.140947 [ 25999 ] <Fatal> BaseDaemon: 5. /build/build_docker/../contrib/jemalloc/src/extent.c:185: extent_alloc @ 0x135a648b in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.144868 [ 25999 ] <Fatal> BaseDaemon: 6. /build/build_docker/../contrib/jemalloc/src/extent.c:2104: extent_split_impl @ 0x135aae61 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.147520 [ 25999 ] <Fatal> BaseDaemon: 7. /build/build_docker/../contrib/jemalloc/src/extent.c:1017: extent_split_interior @ 0x135ad778 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.149507 [ 25999 ] <Fatal> BaseDaemon: 8.1. inlined from /build/build_docker/../contrib/jemalloc/src/extent.c:1066: extent_recycle_split
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.149613 [ 25999 ] <Fatal> BaseDaemon: 8. ../contrib/jemalloc/src/extent.c:1148: extent_recycle @ 0x135a7ee8 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.153074 [ 25999 ] <Fatal> BaseDaemon: 9.1. inlined from /build/build_docker/../contrib/jemalloc/src/extent.c:1471: extent_alloc_retained
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.153160 [ 25999 ] <Fatal> BaseDaemon: 9. ../contrib/jemalloc/src/extent.c:1539: extent_alloc_wrapper @ 0x135a910d in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.155981 [ 25999 ] <Fatal> BaseDaemon: 10.1. inlined from /build/build_docker/../contrib/jemalloc/src/arena.c:1217: arena_slab_alloc_hard
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.156062 [ 25999 ] <Fatal> BaseDaemon: 10.2. inlined from ../contrib/jemalloc/src/arena.c:1247: arena_slab_alloc
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.156157 [ 25999 ] <Fatal> BaseDaemon: 10.3. inlined from ../contrib/jemalloc/src/arena.c:1283: arena_bin_nonfull_slab_get
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.156254 [ 25999 ] <Fatal> BaseDaemon: 10. ../contrib/jemalloc/src/arena.c:1319: arena_bin_malloc_hard @ 0x1359fc8e in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.158957 [ 25999 ] <Fatal> BaseDaemon: 11. /build/build_docker/../contrib/jemalloc/src/arena.c:1414: arena_tcache_fill_small @ 0x1359f819 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.160425 [ 25999 ] <Fatal> BaseDaemon: 12. /build/build_docker/../contrib/jemalloc/src/tcache.c:97: tcache_alloc_small_hard @ 0x135f1476 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.161478 [ 25999 ] <Fatal> BaseDaemon: 13.1. inlined from /build/build_docker/../contrib/jemalloc/include/jemalloc/internal/tcache_inlines.h:0: tcache_alloc_small
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.161559 [ 25999 ] <Fatal> BaseDaemon: 13.2. inlined from ../contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:165: arena_malloc
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.161692 [ 25999 ] <Fatal> BaseDaemon: 13.3. inlined from ../contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:53: iallocztm
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.161777 [ 25999 ] <Fatal> BaseDaemon: 13.4. inlined from ../contrib/jemalloc/src/jemalloc.c:1935: imalloc_no_sample
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.161878 [ 25999 ] <Fatal> BaseDaemon: 13.5. inlined from ../contrib/jemalloc/src/jemalloc.c:2135: imalloc_body
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.161979 [ 25999 ] <Fatal> BaseDaemon: 13.6. inlined from ../contrib/jemalloc/src/jemalloc.c:2244: imalloc
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.162065 [ 25999 ] <Fatal> BaseDaemon: 13. ../contrib/jemalloc/src/jemalloc.c:2275: malloc_default @ 0x13584a9e in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.162632 [ 25999 ] <Fatal> BaseDaemon: 14.1. inlined from /build/build_docker/../src/Common/memory.h:23: Memory::newImpl(unsigned long)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.162712 [ 25999 ] <Fatal> BaseDaemon: 14. ../src/Common/new_delete.cpp:14: operator new(unsigned long) @ 0x9895683 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.170754 [ 25999 ] <Fatal> BaseDaemon: 15.1. inlined from /build/build_docker/../contrib/libcxx/include/new:235: void* std::__1::__libcpp_operator_new<unsigned long>(unsigned long)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.170902 [ 25999 ] <Fatal> BaseDaemon: 15.2. inlined from ../contrib/libcxx/include/new:261: std::__1::__libcpp_allocate(unsigned long, unsigned long)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.171005 [ 25999 ] <Fatal> BaseDaemon: 15.3. inlined from ../contrib/libcxx/include/memory:840: std::__1::allocator<std::__1::__shared_ptr_emplace<DB::ASTLiteral, std::__1::allocator<DB::ASTLiteral> > >::allocate(unsigned long)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.171124 [ 25999 ] <Fatal> BaseDaemon: 15.4. inlined from ../contrib/libcxx/include/__memory/allocator_traits.h:468: std::__1::allocator_traits<std::__1::allocator<std::__1::__shared_ptr_emplace<DB::ASTLiteral, std::__1::allocator<DB::ASTLiteral> > > >::allocate(std::__1::allocator<std::__1::__shared_ptr_emplace<DB::ASTLiteral, std::__1::allocator<DB::ASTLiteral> > >&, unsigned long)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.171234 [ 25999 ] <Fatal> BaseDaemon: 15.5. inlined from ../contrib/libcxx/include/__memory/utilities.h:56: __allocation_guard<std::__1::allocator<DB::ASTLiteral> >
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.171328 [ 25999 ] <Fatal> BaseDaemon: 15. ../contrib/libcxx/include/memory:3359: std::__1::shared_ptr<DB::ASTLiteral> std::__1::allocate_shared<DB::ASTLiteral, std::__1::allocator<DB::ASTLiteral>, DB::ASTLiteral const&, void>(std::__1::allocator<DB::ASTLiteral> const&, DB::ASTLiteral const&) @ 0x11c4f036 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.178244 [ 25999 ] <Fatal> BaseDaemon: 16. /build/build_docker/../src/Parsers/ASTLiteral.h:43: DB::ASTLiteral::clone() const @ 0x11c4ef8c in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.185052 [ 25999 ] <Fatal> BaseDaemon: 17.1. inlined from /build/build_docker/../contrib/libcxx/include/type_traits:3935: std::__1::enable_if<(is_move_constructible<DB::IAST*>::value) && (is_move_assignable<DB::IAST*>::value), void>::type std::__1::swap<DB::IAST*>(DB::IAST*&, DB::IAST*&)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.185161 [ 25999 ] <Fatal> BaseDaemon: 17.2. inlined from ../contrib/libcxx/include/memory:3299: std::__1::shared_ptr<DB::IAST>::swap(std::__1::shared_ptr<DB::IAST>&)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.185244 [ 25999 ] <Fatal> BaseDaemon: 17.3. inlined from ../contrib/libcxx/include/memory:3243: std::__1::shared_ptr<DB::IAST>::operator=(std::__1::shared_ptr<DB::IAST>&&)
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.185358 [ 25999 ] <Fatal> BaseDaemon: 17. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:95: DB::UserDefinedSQLFunctionMatcher::tryToReplaceFunction(DB::ASTFunction const&) @ 0x1110ef69 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.191102 [ 25999 ] <Fatal> BaseDaemon: 18. /build/build_docker/../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:27: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e963 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.196806 [ 25999 ] <Fatal> BaseDaemon: 19.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.196940 [ 25999 ] <Fatal> BaseDaemon: 19. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.202581 [ 25999 ] <Fatal> BaseDaemon: 20.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.202662 [ 25999 ] <Fatal> BaseDaemon: 20. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.208033 [ 25999 ] <Fatal> BaseDaemon: 21.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.208112 [ 25999 ] <Fatal> BaseDaemon: 21. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.213505 [ 25999 ] <Fatal> BaseDaemon: 22.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.213609 [ 25999 ] <Fatal> BaseDaemon: 22. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.218914 [ 25999 ] <Fatal> BaseDaemon: 23.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.218991 [ 25999 ] <Fatal> BaseDaemon: 23. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.224253 [ 25999 ] <Fatal> BaseDaemon: 24.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.224348 [ 25999 ] <Fatal> BaseDaemon: 24. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.229761 [ 25999 ] <Fatal> BaseDaemon: 25.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.229841 [ 25999 ] <Fatal> BaseDaemon: 25. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.235219 [ 25999 ] <Fatal> BaseDaemon: 26.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.235310 [ 25999 ] <Fatal> BaseDaemon: 26. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.240568 [ 25999 ] <Fatal> BaseDaemon: 27.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.240647 [ 25999 ] <Fatal> BaseDaemon: 27. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.246117 [ 25999 ] <Fatal> BaseDaemon: 28.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.246211 [ 25999 ] <Fatal> BaseDaemon: 28. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.251643 [ 25999 ] <Fatal> BaseDaemon: 29.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.251743 [ 25999 ] <Fatal> BaseDaemon: 29. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.257189 [ 25999 ] <Fatal> BaseDaemon: 30.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.257279 [ 25999 ] <Fatal> BaseDaemon: 30. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.262547 [ 25999 ] <Fatal> BaseDaemon: 31.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.262641 [ 25999 ] <Fatal> BaseDaemon: 31. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.267910 [ 25999 ] <Fatal> BaseDaemon: 32.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.268010 [ 25999 ] <Fatal> BaseDaemon: 32. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.273263 [ 25999 ] <Fatal> BaseDaemon: 33.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.273350 [ 25999 ] <Fatal> BaseDaemon: 33. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.278683 [ 25999 ] <Fatal> BaseDaemon: 34.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.278785 [ 25999 ] <Fatal> BaseDaemon: 34. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.284066 [ 25999 ] <Fatal> BaseDaemon: 35.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.284156 [ 25999 ] <Fatal> BaseDaemon: 35. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.289497 [ 25999 ] <Fatal> BaseDaemon: 36.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.289583 [ 25999 ] <Fatal> BaseDaemon: 36. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.294899 [ 25999 ] <Fatal> BaseDaemon: 37.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.294988 [ 25999 ] <Fatal> BaseDaemon: 37. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.300419 [ 25999 ] <Fatal> BaseDaemon: 38.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.300511 [ 25999 ] <Fatal> BaseDaemon: 38. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.305738 [ 25999 ] <Fatal> BaseDaemon: 39.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.305832 [ 25999 ] <Fatal> BaseDaemon: 39. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.311029 [ 25999 ] <Fatal> BaseDaemon: 40.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.311123 [ 25999 ] <Fatal> BaseDaemon: 40. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.316350 [ 25999 ] <Fatal> BaseDaemon: 41.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.316444 [ 25999 ] <Fatal> BaseDaemon: 41. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.321708 [ 25999 ] <Fatal> BaseDaemon: 42.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.321805 [ 25999 ] <Fatal> BaseDaemon: 42. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.326977 [ 25999 ] <Fatal> BaseDaemon: 43.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.327076 [ 25999 ] <Fatal> BaseDaemon: 43. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.332220 [ 25999 ] <Fatal> BaseDaemon: 44.1. inlined from /build/build_docker/../contrib/libcxx/include/memory:3211: ~shared_ptr
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.332312 [ 25999 ] <Fatal> BaseDaemon: 44. ../src/Interpreters/UserDefinedSQLFunctionVisitor.cpp:34: DB::UserDefinedSQLFunctionMatcher::visit(std::__1::shared_ptr<DB::IAST>&, DB::UserDefinedSQLFunctionMatcher::Data&) @ 0x1110e9c0 in /home/avtokmakov/ch/tmp/clickhouse
[avtokmakov-dev.sas.yp-c.yandex.net] 2021.10.29 16:24:50.516068 [ 25999 ] <Fatal> BaseDaemon: Checksum of the binary: 62775825C240240D0C8C1D384736C782, integrity check passed.

```
/** Visits ASTFunction nodes and if it is used defined function replace it with function body.
  * Example:
  *
  * CREATE FUNCTION test_function AS a -> a + 1;
  *
  * Before applying visitor:
  * SELECT test_function(number) FROM system.numbers LIMIT 10;
  *
  * After applying visitor:
  * SELECT number + 1 FROM system.numbers LIMIT 10;
  */
class UserDefinedSQLFunctionMatcher
{
public:
    using Visitor = InDepthNodeVisitor<UserDefinedSQLFunctionMatcher, true>;
    struct Data
    {
    };
    static void visit(ASTPtr & ast, Data & data);
    static bool needChildVisit(const ASTPtr & node, const ASTPtr & child);
private:
    static void visit(ASTFunction & func, const Data & data);
    static ASTPtr tryToReplaceFunction(const ASTFunction & function);
};
using UserDefinedSQLFunctionVisitor = UserDefinedSQLFunctionMatcher::Visitor;
}