Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi5ov-0003CR-RO for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2014 17:39:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wi5ov-0001pz-8j for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2014 17:39:53 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi5ot-0001ni-3n; Wed, 07 May 2014 17:39:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi5oo-0005k5-Rl; Wed, 07 May 2014 17:39:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s47HdhrS031797; Wed, 7 May 2014 13:39:43 -0400 From: Tom Lane To: Leif Jensen cc: Adrian Klaver , pgsql-general , pgsql-bugs@postgresql.org Subject: Re: Server process crash - Segmentation fault In-reply-to: <4548428.10806.1399483016605.JavaMail.root@quick> References: <4548428.10806.1399483016605.JavaMail.root@quick> Comments: In-reply-to Leif Jensen message dated "Wed, 07 May 2014 19:16:56 +0200" Date: Wed, 07 May 2014 13:39:43 -0400 Message-ID: <31796.1399484383@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Leif Jensen 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