I just wanted to check if this has been fixed in any recent v8.1.x
release, since I'm using v8.1.0 now.

Backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x08152448 in qual_is_pushdown_safe ()
(gdb) bt
#0  0x08152448 in qual_is_pushdown_safe ()
#1  0x08151e47 in set_subquery_pathlist ()
#2  0x08151a3c in set_base_rel_pathlists ()
#3  0x08151960 in make_one_rel ()
#4  0x0815dcaf in query_planner ()
#5  0x0815ea19 in grouping_planner ()
#6  0x0815e2e4 in subquery_planner ()
#7  0x0815dfaa in planner ()
#8  0x08197b7c in pg_plan_query ()
#9  0x08197c39 in pg_plan_queries ()
#10 0x08197e3d in exec_simple_query ()
#11 0x0819a6fe in PostgresMain ()
#12 0x08176356 in BackendRun ()
#13 0x08175c77 in BackendStartup ()
#14 0x08173ee2 in ServerLoop ()
#15 0x08173723 in PostmasterMain ()
#16 0x08139f90 in main ()
#17 0x400dc14f in __libc_start_main () from /lib/libc.so.6


The crashing query is below, if I remove the "not is null" test it
doesn't crash.

How to reproduce:

create table snicker_whatever(
    id SERIAL primary key
    );

create table snicker (
    id            SERIAL primary key,
    name_singular text not null unique,
    name_plural   text not null unique
    );

create table snicker_group (
    id              SERIAL primary key,
    title       varchar(64) not null,
    snicker_id  integer not null references snicker_whatever(id)
);

create table snicker_group_mapping (
    id                     SERIAL primary key,
    snicker_group_id   integer not null references snicker_group(id),
    snicker_id         integer references snicker(id)
    );


SELECT DISTINCT
    *
FROM
    (
    SELECT
        vtgm.snicker_id
    FROM snicker_group_mapping vtgm
    WHERE exists
        (
        SELECT
            *
        FROM snicker_group vtg
        WHERE vtgm.snicker_group_id = vtg.id
            AND lower(vtg.title) ~* 'test'
        )
    UNION
    SELECT
        snicker.id
    FROM snicker
    WHERE lower(snicker.name_singular) ~* 'test'
        OR lower(snicker.name_plural) ~* 'test'
    ) AS vt_id
WHERE vt_id is not null;

Regards,
Magnus

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to