From: Tom Lane <tgl@sss.pgh.pa.us>
To: Leif Jensen <leif@crysberg.dk>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Server process crash - Segmentation fault
Date: Wed, 07 May 2014 13:39:43 -0400
Message-ID: <31796.1399484383@sss.pgh.pa.us> (raw)
In-Reply-To: <4548428.10806.1399483016605.JavaMail.root@quick>
References: <4548428.10806.1399483016605.JavaMail.root@quick>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Leif Jensen <leif@crysberg.dk> writes:
> Could it be related to the OFFSET part of the statement ? I have another query on the same table without OFFSET, which seems to work fine.
Yeah, the specific code path here involves executing a stable (or possibly
immutable) SQL function in a LIMIT or OFFSET clause. I was able to
reproduce the crash like so:
create function foo(int) returns int as 'select $1 limit 1'
language sql stable;
begin;
declare c cursor for select * from int8_tbl limit foo(3);
select * from c;
move backward all in c;
select * from c;
commit;
You might be able to dodge the problem if you can make the SQL function
inline-able (the LIMIT 1 in my example is just to prevent that from
happening). A less appealing alternative is to mark the function
VOLATILE, which I think would also prevent this crash, but might have
negative performance consequences.
If you don't mind building your own PG then you could grab the actual fix
from our git repo; I should have something committed before long.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
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: tgl@sss.pgh.pa.us, leif@crysberg.dk, adrian.klaver@aklaver.com, pgsql-general@postgresql.org
Subject: Re: Server process crash - Segmentation fault
In-Reply-To: <31796.1399484383@sss.pgh.pa.us>
References: <4548428.10806.1399483016605.JavaMail.root@quick> <31796.1399484383@sss.pgh.pa.us>
* 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