I am developing against 9.1beta3 and encountered this problem. I repeated it against rc1 (or
actually, REL9_1_STABLE taken from git today).

The below SQL causes:

TRAP: FailedAssertion("!(item_width > 0)", File: "costsize.c", Line: 3274)

and the session crashes.


select *
from (
select
col1
, col2
, reviewed
from
(values
( 1111, 'aweyu', 3)
, ( 2222, 'bwetu', 2)
, ( 3333, 'vwxyz', 1)
)
as r(col1,col2,col3)
left join (
select 1 as reviewed, c2 from ( values ('abcde') ) as t1(c2)
union all select 0 as reviewed, c2 from ( values ('vwxyz') ) as t2(c2)
)
as up_all on up_all.c2 = r.col2
order by col3
)
as f
;


To simplify I used 'values' for the actual tables that I am using, but the above still causes the
FailedAssertion.

Removing the outer select avoids the error and
removing order by avoids the error


Erik Rijkers

Search Discussions

  • Robert Haas at Aug 22, 2011 at 10:19 pm

    On Mon, Aug 22, 2011 at 4:16 PM, Erik Rijkers wrote:
    I am developing against 9.1beta3 and encountered this problem. I repeated it against rc1 (or
    actually, REL9_1_STABLE taken from git today).

    The below SQL causes:

    TRAP: FailedAssertion("!(item_width > 0)", File: "costsize.c", Line: 3274)

    and the session crashes.

    select *
    from (
    select
    col1
    ,  col2
    ,  reviewed
    from
    (values
    ( 1111, 'aweyu', 3)
    , ( 2222, 'bwetu', 2)
    , ( 3333, 'vwxyz', 1)
    )
    as r(col1,col2,col3)
    left join (
    select 1 as reviewed, c2 from ( values ('abcde') ) as t1(c2)
    union all select 0 as reviewed, c2 from ( values ('vwxyz') ) as t2(c2)
    )
    as up_all on up_all.c2 = r.col2
    order by col3
    )
    as f
    ;


    To simplify I used 'values' for the actual tables that I am using, but the above still causes the
    FailedAssertion.

    Removing the outer select avoids the error and
    removing order by avoids the error
    I can reproduce this on master but not on 9.0. I suspect the problem
    was introduced by this commit:

    commit 0f61d4dd1b4f95832dcd81c9688dac56fd6b5687
    Author: Tom Lane <tgl@sss.pgh.pa.us>
    Date: Fri Nov 19 17:31:50 2010 -0500

    Improve relation width estimation for subqueries.

    ...but I haven't confirmed that yet.

    --
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise PostgreSQL Company
  • Tom Lane at Aug 23, 2011 at 3:23 am

    Robert Haas writes:
    On Mon, Aug 22, 2011 at 4:16 PM, Erik Rijkers wrote:
    The below SQL causes:
    TRAP: FailedAssertion("!(item_width > 0)", File: "costsize.c", Line: 3274)
    I can reproduce this on master but not on 9.0. I suspect the problem
    was introduced by this commit:
    commit 0f61d4dd1b4f95832dcd81c9688dac56fd6b5687
    Well, that's a pretty safe bet considering the Assert is in code that
    didn't exist before that commit ;-). The question is why the per-column
    width estimate hasn't been set for that column. Looking at the
    coredump, I see that the width *did* get set for the subquery's other
    output column, which makes it even weirder. Too tired to dig further
    right now though.

    regards, tom lane
  • Tom Lane at Aug 23, 2011 at 9:14 pm

    "Erik Rijkers" <er@xs4all.nl> writes:
    The below SQL causes:
    TRAP: FailedAssertion("!(item_width > 0)", File: "costsize.c", Line: 3274)
    Thanks, I've applied a patch for this.

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedAug 22, '11 at 8:22p
activeAug 23, '11 at 9:14p
posts4
users3
websitepostgresql.org...
irc#postgresql

People

Translate

site design / logo © 2021 Grokbase