Обсуждение: ToDo: API for SQL statement execution other than SPI
Hi
I am writing two background workers - autoreindex and scheduler. In Both I need to execute queries from top level. I had to wrote redundant code https://github.com/okbob/autoreindex/blob/master/utils.c autoreindex_execute_sql_command .Same code is in pglogical. Some statements - like VACUUM or REINDEX CONCURRENTLY is not possible call from SPI.Can be nice to have this function in core.
Regards
Pavel
On 29 June 2016 at 13:55, Pavel Stehule <pavel.stehule@gmail.com> wrote:
HiI am writing two background workers - autoreindex and scheduler. In Both I need to execute queries from top level. I had to wrote redundant code https://github.com/okbob/autoreindex/blob/master/utils.c autoreindex_execute_sql_command .Same code is in pglogical. Some statements - like VACUUM or REINDEX CONCURRENTLY is not possible call from SPI.Can be nice to have this function in core.
I strongly agree. In particular, something that can clean up and recover from ERRORs. Right now you have to borrow a bunch of PostgresMain.
On Wed, Jun 29, 2016 at 1:55 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote: > I am writing two background workers - autoreindex and scheduler. In Both I > need to execute queries from top level. I had to wrote redundant code > https://github.com/okbob/autoreindex/blob/master/utils.c > autoreindex_execute_sql_command .Same code is in pglogical. Some statements > - like VACUUM or REINDEX CONCURRENTLY is not possible call from SPI. > > Can be nice to have this function in core. pg_background handles this. Somebody might want to resurrect that patch. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On Jul 1, 2016, at 11:39 AM, Robert Haas <robertmhaas@gmail.com> wrote:On Wed, Jun 29, 2016 at 1:55 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:I am writing two background workers - autoreindex and scheduler. In Both I
need to execute queries from top level. I had to wrote redundant code
https://github.com/okbob/autoreindex/blob/master/utils.c
autoreindex_execute_sql_command .Same code is in pglogical. Some statements
- like VACUUM or REINDEX CONCURRENTLY is not possible call from SPI.
Can be nice to have this function in core.
pg_background handles this. Somebody might want to resurrect that patch.
Thanks & Regards,
Vibhor Kumar
Vibhor Kumar