Re: Does anyone know of any issues around ARRAY UNNEST

From: Belinda Cussen <belinda(dot)cussen(at)servian(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Does anyone know of any issues around ARRAY UNNEST
Date: 2011-11-28 04:04:25
Message-ID: CA+QS4W6Wzg_ng6ACincg4yLRyxwqyoaniVx+-nV+dL7gCwvPLQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks!

On 28 November 2011 14:30, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Belinda Cussen <belinda(dot)cussen(at)servian(dot)com(dot)au> writes:
> > I've managed to produce this fault consistently now.
> > Below is the simplified code:
>
> > CREATE TABLE foo_1 (id int primary key,media_uri TEXT);
> > INSERT INTO foo_1(id) SELECT i FROM generate_series(1,1000000) g(i);
>
> > CREATE OR REPLACE FUNCTION bb_crash_db_5 () RETURNS TEXT AS $$
> > DECLARE
> > v_activity_id_list INTEGER ARRAY;
> > BEGIN
>
> > SELECT ARRAY(SELECT id FROM foo_1 ORDER BY id LIMIT 100000) INTO
> > v_activity_id_list;
> > UPDATE foo_1
> > SET media_uri = 'a'
> > WHERE id IN (SELECT activity_id FROM UNNEST (v_activity_id_list)
> > activity_id)
> > ;
> > return 'success';
>
> > END;
> > $$ LANGUAGE plpgsql;
>
> > I then open 2 command lines and run:
> > select bb_crash_db_5();
>
> Thanks, I was able to reproduce it with this test case. It turns out
> not to have anything directly to do with UNNEST, but with the code that
> deals with concurrent row updates.
>
> I've committed a fix, which will appear in next week's updates.
> Thanks for the report and test case!
>
> regards, tom lane
>

--
[image: Servian Logo]*Belinda Cussen* | Servian Pty
Ltd<http://www.servian.com.au/> |
*m:* 0466 309 169 | *t:* 02 9376 0700 | f*:* 02 9376 0730

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Muiz 2011-11-29 02:00:35 plpgsql: how to get the exception's detail information?
Previous Message Tom Lane 2011-11-28 03:30:17 Re: Does anyone know of any issues around ARRAY UNNEST