Re: logical decoding output plugin

From: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: logical decoding output plugin
Date: 2016-12-11 10:31:17
Message-ID: CAKkG4_knY8Pq8yc67VHcTU4kxy43YOaPzZa3CcJSQa=gCzYUhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Dec 11, 2016 at 12:10 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:

> On 2016-12-10 22:34:02 +0100, Torsten Förtsch wrote:
> > I am working on a logical decoding output plugin. I am only interested in
> > the changes in one particular table.
> >
> > One way to check for the table would be to compare class_form->relname
> > and get_namespace_name(class_form->relnamespace). But I'd much prefer to
> > just compare the OID of the table.
> >
> > Is there a cheap way to do something like "SELECT
> > 'schema.table'::regclass::oid" that can be called in the startup
> callback?
>
> You shouldn't do it in the startup callback (no catalog access there),
> but you can do it the first time through the change callback.
>
> For lookups the most complete lookup is to use RangeVarGetRelid() to get
> the oid. There's other variants, but that's the easiest approach.
>
> Do you have to care about the table being renamed?
>

Thanks, Andres. That would be nice to have but not really necessary, at
least not at the beginning. Is it possible to catch CREATE TABLE and ALTER
TABLE RENAME in 9.5?

Thanks,
Torsten

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-12-11 16:37:17 Re: Index size
Previous Message Michael Paquier 2016-12-11 06:50:56 Re: Is is safe to use SPI in multiple threads?