On 07/29/2015 09:42 PM, Robert Haas wrote:
+ <warning>
+ <para>
+ Use of this field is deprecated. It should be set to
+ <literal>NULL</literal> then <structfield>bgw_library_name</structfield>
+ and <structfield>bgw_function_name</structfield> should be used instead.
+ </para>
I don't think bgw_main is exactly deprecated. It's fine to use it if
the function is in the core code; it just can't be safely used for
functions in dynamically loaded shared libraries. Maybe that's close
enough to "deprecated" that we should just call it deprecated, but I'm
slightly reluctant to use that word.
Hmm. worker_spi module uses bgw_main. Is that bad? Given that work_spi
is supposedly an example or template that you copy-paste from when
writing your own bgworker, we should make sure it follows the best
practice. Also, I note that worker_spi doesn't memset(0) its
BackgroundWorker struct, so any uninitialized fields will contain
garbage. Including bgw_library_name and bgw_function_name. That seems bad.
I've committed some bits of this that seem useful and controversial
with rather extensive wordsmithing; let me know if it doesn't look
good.
I've marked this as committed in the commitfest. If we're waiting for a
followup patch for the remaining bits, please change it back to Waiting
on Author, or post the followup patch to the next commitfest if it can't
be done quickly.
- Heikki
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs