Hi Richard,

With v2 this scans both partitions, on master only pc1.

    CREATE FUNCTION pf(numeric) RETURNS numeric
      LANGUAGE sql IMMUTABLE AS 'SELECT $1';
    CREATE TABLE pc (a numeric(10), b numeric(10))
      PARTITION BY LIST ((COALESCE(pf(a), b)));
    CREATE TABLE pc1 PARTITION OF pc FOR VALUES IN (1);
    CREATE TABLE pc2 PARTITION OF pc FOR VALUES IN (2);
    EXPLAIN (COSTS OFF) SELECT * FROM pc WHERE COALESCE(pf(a), b) = 1;

This is because the key is RelabelType, partprune.c shard it only from the
clause.

Thanks,
Shihao

Attachment: nocfbot-0001-Shard-relabeling-from-the-partition-key-when-matching.patch
Description: Binary data

Reply via email to