Use DatumGetInt32() to extract 32-bit integer value from a datum.
authorFujii Masao <fujii@postgresql.org>
Tue, 18 Apr 2017 15:12:27 +0000 (00:12 +0900)
committerFujii Masao <fujii@postgresql.org>
Tue, 18 Apr 2017 15:12:27 +0000 (00:12 +0900)
Previously DatumGetObjectId() was wrongly used for that.

Author: Masahiko Sawada
Reviewed-by: Kyotaro Horiguchi
Reported-by: Fujii Masao
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com

src/backend/replication/logical/launcher.c
src/backend/replication/logical/worker.c

index 35e9d0305f68a7deabdb27a295d7ac6a5219f716..0dba25962ad88714cd288c2d8d834572b8326448 100644 (file)
@@ -306,7 +306,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
 
    bgw.bgw_restart_time = BGW_NEVER_RESTART;
    bgw.bgw_notify_pid = MyProcPid;
-   bgw.bgw_main_arg = slot;
+   bgw.bgw_main_arg = Int32GetDatum(slot);
 
    if (!RegisterDynamicBackgroundWorker(&bgw, &bgw_handle))
    {
index 656d3999796dc782e5cae7896cdf3a53897fc54c..fa4f3b652d5e72fcb8a9a639fc6c195813ba072e 100644 (file)
@@ -1441,7 +1441,7 @@ subscription_change_cb(Datum arg, int cacheid, uint32 hashvalue)
 void
 ApplyWorkerMain(Datum main_arg)
 {
-   int             worker_slot = DatumGetObjectId(main_arg);
+   int             worker_slot = DatumGetInt32(main_arg);
    MemoryContext   oldctx;
    char            originname[NAMEDATALEN];
    XLogRecPtr      origin_startpos;