pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Ben Chobot <bench@silentmedia.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
Date: Fri, 6 Oct 2017 21:29:08 -0700
Message-ID: <20171007042908.edlsalmkm2ksac4y@alap3.anarazel.de> (raw)
In-Reply-To: <34F8B14B-ABA4-45A3-92CE-2E1B755398EF@silentmedia.com>
References: <CAB7nPqRZhE53NYVyOf5-WW6eoN9ZJhg6QeDDyfRfyZj4ESeQFA@mail.gmail.com>
	<8637.1507217920@sss.pgh.pa.us>
	<20171005211058.z5obk2c2e7zvauk6@alap3.anarazel.de>
	<32374.1507239819@sss.pgh.pa.us>
	<20171005230105.qv2yrtadbkbc5y5r@alap3.anarazel.de>
	<4563.1507246950@sss.pgh.pa.us>
	<20171006052105.jfxllpi6lcu7q2a7@alap3.anarazel.de>
	<409.1507325342@sss.pgh.pa.us>
	<32118.1507332070@sss.pgh.pa.us>
	<34F8B14B-ABA4-45A3-92CE-2E1B755398EF@silentmedia.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2017-10-06 21:24:34 -0700, Ben Chobot wrote:
> 
> > On Oct 6, 2017, at 4:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > 
> > I wrote:
> >> I thought of a better way, as attached.
> > 
> > Pushed.  Ben, could you confirm that the committed patch fixes your
> > original use-case?  The 9.5 version of the patch is at
> > 
> > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=13d2ed921035f2d88adf87d796373e920...
> 
> Not quickly, to be honest. But the test case is not hard. If you can do this without crashing, I'm convinced you've fixed the problem as I've seen it:
> 
> 
> SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
> 
> CREATE TABLE public.foo(i int);
> 
> insert into public.foo(i) values(1);
> 
> CREATE OR REPLACE FUNCTION logical_replication_slot_lsn_delta(slot text) RETURNS pg_lsn AS
> $$
>  BEGIN
>      return location from pg_logical_slot_peek_changes(slot,null,1) limit 1;
>  END
> $$ language plpgsql;
> 
> select logical_replication_slot_lsn_delta('regression_slot');

Yep, that one's definitely fixed now.

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (19+ messages)  latest in thread

Message-ID: <20171007042908.edlsalmkm2ksac4y@alap3.anarazel.de>
Permalink:  ../20171007042908.edlsalmkm2ksac4y@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20171007042908.edlsalmkm2ksac4y@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, bench@silentmedia.com, tgl@sss.pgh.pa.us, michael.paquier@gmail.com
  Subject: Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
  In-Reply-To: <20171007042908.edlsalmkm2ksac4y@alap3.anarazel.de>
  References: <CAB7nPqRZhE53NYVyOf5-WW6eoN9ZJhg6QeDDyfRfyZj4ESeQFA@mail.gmail.com> <8637.1507217920@sss.pgh.pa.us> <20171005211058.z5obk2c2e7zvauk6@alap3.anarazel.de> <32374.1507239819@sss.pgh.pa.us> <20171005230105.qv2yrtadbkbc5y5r@alap3.anarazel.de> <4563.1507246950@sss.pgh.pa.us> <20171006052105.jfxllpi6lcu7q2a7@alap3.anarazel.de> <409.1507325342@sss.pgh.pa.us> <32118.1507332070@sss.pgh.pa.us> <34F8B14B-ABA4-45A3-92CE-2E1B755398EF@silentmedia.com> <20171007042908.edlsalmkm2ksac4y@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox