Re: PostgreSQL logical decoder output plugin - unchanged toast data - Mailing list pgsql-hackers

From Andres Freund
Subject Re: PostgreSQL logical decoder output plugin - unchanged toast data
Date
Msg-id 20180904164240.mehuqs6ghkapqgw5@alap3.anarazel.de
Whole thread Raw
In response to Re: PostgreSQL logical decoder output plugin - unchanged toast data  (Georgy Buranov <gburanov@gmail.com>)
List pgsql-hackers
Hi,

On 2018-09-04 11:45:10 +0200, Georgy Buranov wrote:
> Hi Andres. Thank you very much for your help.
> 
> I tried the following solution and I have some problems.
> 
> * I have 9.6 postgres and I do not have separate field for rd_pkindex
> * All I have is rd_replidindex field. Usually (when REPLICA IDENTITY
> is NOT FULL), it still contains the primary key
> * But in the case of REPLICA IDENTITY FULL - rd_replidindex is NULL
> and rd_pkindex does not exist
> 
> So, is there a way to get the primary key on 9.6 postgres?

You have to to query the syscache yourself, in that case.  I know
nothing about what you're doing in your output plugin.  In the ones I
wrote there's a side-cache for per-relation output plugin specific data,
do you have something like that?  You can probably just crib the code
for the lookup from dblink.c:get_pkey_attnames().  If you have a cache,
itmight be worth caching the results.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Bug fix for glibc broke freebsd build in REL_11_STABLE
Next
From: Alvaro Herrera
Date:
Subject: Re: pointless check in RelationBuildPartitionDesc