PostgreSQLのexec_simple_query関数は、クエリ文字列を構文解析する関数などを呼び出しながら、クエリ文字列をparsetree_list、querytree_list、plantree_listに変換していきます。この処理の大まかなフローを、今回は図として描いてみます。図を描くには、Mermaidを使います。
以下は参考のメモ
2 postgres 0x00000001031c8504 HeapTupleSatisfiesVisibility + 132
3 postgres 0x00000001031ad7f4 heapgetpage + 548
4 postgres 0x00000001031aea68 heapgettup_pagemode + 296
5 postgres 0x00000001031aef4b heap_getnextslot + 75
6 postgres 0x00000001034d4d4b table_scan_getnextslot + 299
7 postgres 0x00000001034d4b7c SeqNext + 140
8 postgres 0x000000010348e85b ExecScanFetch + 699
9 postgres 0x000000010348e472 ExecScan + 114
10 postgres 0x00000001034d4735 ExecSeqScan + 53
11 postgres 0x0000000103489bf2 ExecProcNodeFirst + 82
12 postgres 0x00000001034815d2 ExecProcNode + 50
13 postgres 0x000000010347c9e1 ExecutePlan + 209
14 postgres 0x000000010347c87b standard_ExecutorRun + 571
15 postgres 0x000000010347c632 ExecutorRun + 98
16 postgres 0x00000001037643d4 PortalRunSelect + 308
17 postgres 0x0000000103763db9 PortalRun + 809
18 postgres 0x000000010375f1bb exec_simple_query + 1467
19 postgres 0x000000010375e2ad PostgresMain + 2221
20 postgres 0x000000010366b942 BackendRun + 50
21 postgres 0x000000010366921c BackendStartup + 524
22 postgres 0x0000000103666bfe ServerLoop + 350
23 postgres 0x0000000103665850 PostmasterMain + 6496
24 postgres 0x0000000103510742 main + 818
25 dyld 0x00007ff812095310 start + 2432