| From: | Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com> | 
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org | 
| Subject: | Support worker_spi to execute the function dynamically. | 
| Date: | 2023-07-20 02:15:51 | 
| Message-ID: | d30d3ea7d21cb7c9e1e3cc47e301f1b6@oss.nttdata.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi,
While I'm working on the thread[1], I found that the function of
worker_spi module fails if 'shared_preload_libraries' doesn't have
worker_spi.
The reason is that the database name is NULL because the database name
is initialized only when process_shared_preload_libraries_in_progress
is true.
```
psql=# SELECT worker_spi_launch(1) ;
2023-07-20 11:00:56.491 JST [1179891] LOG:  worker_spi worker 1 
initialized with schema1.counted
2023-07-20 11:00:56.491 JST [1179891] FATAL:  cannot read pg_class 
without having selected a database at character 22
2023-07-20 11:00:56.491 JST [1179891] QUERY:  select count(*) from 
pg_namespace where nspname = 'schema1'
2023-07-20 11:00:56.491 JST [1179891] STATEMENT:  select count(*) from 
pg_namespace where nspname = 'schema1'
2023-07-20 11:00:56.492 JST [1179095] LOG:  background worker 
"worker_spi" (PID 1179891) exited with exit code 1
```
In my understanding, the restriction is not required. So, I think it's
better to change the behavior.
(v1-0001-Support-worker_spi-to-execute-the-function-dynamical.patch)
What do you think?
[1] Support to define custom wait events for extensions
https://www.postgresql.org/message-id/flat/b9f5411acda0cf15c8fbb767702ff43e%40oss.nttdata.com
Regards,
-- 
Masahiro Ikeda
NTT DATA CORPORATION
| Attachment | Content-Type | Size | 
|---|---|---|
| v1-0001-Support-worker_spi-to-execute-the-function-dynamical.patch | text/x-diff | 1.7 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2023-07-20 02:32:06 | Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication | 
| Previous Message | jian he | 2023-07-20 01:35:45 | Re: remaining sql/json patches |