Background Worker Main Function

Listing 4 shows the implementation of the Background Worker process. First of all, the worker creates a StringInfoData variable named queryStringData. This is an internal PostgreSQL type that holds a string (.data), its length (.len), and its possible maximum length (.maxlen). Then, a set of simple log_* variables are initialized with data about the table, including the schema, the username, and other information used to connect to the database in which the entries are to be registered.

When a Background Worker is started, its Posix signals are blocked, so that other processes cannot interrupt the Background Worker during this phase. This way, it can complete its initialization without being interrupted. However, ...

Get PostgreSQL 11 Server Side Programming Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.