Re: [HACKERS] path toward faster partition pruning - Mailing list pgsql-hackers

From Marina Polyakova
Subject Re: [HACKERS] path toward faster partition pruning
Date
Msg-id ff8f9bfa485ff961d6bb43e54120485b@postgrespro.ru
Whole thread Raw
In response to Re: [HACKERS] path toward faster partition pruning  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: [HACKERS] path toward faster partition pruning  (Michael Paquier <michael@paquier.xyz>)
Re: [HACKERS] path toward faster partition pruning  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Hello everyone in this thread!

I got a similar server crash as in [1] on the master branch since the 
commit 9fdb675fc5d2de825414e05939727de8b120ae81 when the assertion fails 
because the second argument ScalarArrayOpExpr is not a Const or an 
ArrayExpr, but is an ArrayCoerceExpr (see [2]):

=# create table list_parted (
   a varchar
) partition by list (a);
=# create table part_ab_cd partition of list_parted for values in ('ab', 
'cd');
=# CREATE OR REPLACE FUNCTION public.x_stl_text_integer (
)
RETURNS text STABLE AS
$body$
BEGIN
RAISE NOTICE 's text integer';
RETURN 1::text;
END;
$body$
LANGUAGE 'plpgsql';
=# explain (costs off) select * from list_parted where a in ('ab', 'cd', 
x_stl_text_integer());
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>

[1] 
https://www.postgresql.org/message-id/CAKcux6nCsCmu9oUnnuKZkeBenYvUFbU2Lt4q2MFNEb7QErzn8w%40mail.gmail.com

[2] partprune.c, function match_clause_to_partition_key:
        if (IsA(rightop, Const))
        {
            ...
        }
        else
        {
            ArrayExpr  *arrexpr = castNode(ArrayExpr, rightop); # fails here
            ...
        }

-- 
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: [HACKERS] Clock with Adaptive Replacement
Next
From: Teodor Sigaev
Date:
Subject: Re: nbtsort.c performs unneeded (though harmless) truncation