Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5E3E-0006OL-BU for pgsql-general@arkaria.postgresql.org; Tue, 03 Sep 2019 19:01:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i5E3C-0005WR-Bf for pgsql-general@arkaria.postgresql.org; Tue, 03 Sep 2019 19:01:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5E3C-0005WK-1Q for pgsql-general@lists.postgresql.org; Tue, 03 Sep 2019 19:01:10 +0000 Received: from mail-yw1-xc35.google.com ([2607:f8b0:4864:20::c35]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i5E39-00018F-Tj for pgsql-general@postgresql.org; Tue, 03 Sep 2019 19:01:09 +0000 Received: by mail-yw1-xc35.google.com with SMTP id k200so1974527ywa.7 for ; Tue, 03 Sep 2019 12:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=entrata-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FY01oKnuQ8ANBl0SCitOV/830u11iNUIAfpjtvQZnkg=; b=hRhzw0QxV5wpX5pBguuQ6ghGa8REZu0lbQ3tmZ3PjkTWTWwAyW3ml6MmzkXy90vvDn XWmvlEXQzDHuTrRbfiFdFK0G18VKRV21QaQUVUA7i2ZFyKNNjBRmmgYiaiUp+W5CdZIE 2ztKwVZH5M5LhtVeFadWzMJFK66v2clSObHGkyTcHd7prqbELZv9Mo3j2ClJ4+PwuyI1 /rl4Kuduu+hY7SDy+hOXO3x/l/9pAuCwhxmooQb4dXKIR6W4ZDME6IR979h4rAKt/POq 1IIP8C2AtB5fTzIi4S7x9JCiozLxXJIXdGAacHssTwOSa0MHXI9QjpmJJIHqDi2EEJm9 3goQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FY01oKnuQ8ANBl0SCitOV/830u11iNUIAfpjtvQZnkg=; b=LrTrUJrZbdvl7n4Sq1vw02h6wEyyCnBp+B6lwrh/tX/aJtyVjMnCdba1yt/w1C6Urx kPXnwBB/nKPYFgnK7MXf+I3gVTYdKoGpe/P3wx9u0QvCFE6YVIuqilr3HYUhlvTJiEEB tp6Z0GelQ0lm4OoO7Uvlhk5tc67SpLqIHR4JA8D4bl4go7umuJ51s3M1lhrvWo8BU8hQ Rk+S9mzyZsqTjHMlDf4ZysjgHqGjHpMYVyKTi61ShbuYnQQWNpsUnorX3AoNpnfjS6W4 OUKJt3qD6Y2TXK+oZrWNRfizRSqCfTMbD8eu4QDhmswT44DbYTLbf5HHfI5ZjdEt5UBX fPTA== X-Gm-Message-State: APjAAAWueg7o+fm9bHECVNgj553tMoQ7bsmKPaQLObpCO4f55m4zG2QC xqQ5eaJyV3PGgMMJfxEWh//AN/2rpZV5UMljCFvBUQ== X-Google-Smtp-Source: APXvYqygEftxEmlBN0n58DLL4iKl86uZPpZoqZ8hlBVwQZY0h9YgocJ6b6kMo/RMjvb11NWgwlATI7cud3ltrJr6C+I= X-Received: by 2002:a81:7912:: with SMTP id u18mr26860009ywc.388.1567537265801; Tue, 03 Sep 2019 12:01:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Michael Lewis Date: Tue, 3 Sep 2019 13:00:39 -0600 Message-ID: Subject: Re: literal vs dynamic partition constraint in plan execution To: Luca Ferrari Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000e68ee30591aab503" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000e68ee30591aab503 Content-Type: text/plain; charset="UTF-8" I think I would expect this behavior with how you have defined the constraints as the function results rather than just being strict comparisons to the timestamp field. Instead of this- Check constraints: > "y2018_mis_ora_check" CHECK (date_part('year'::text, mis_ora) = > 2018::double precision) I would expect this- Check constraints: > "y2018_mis_ora_check" CHECK mis_ora) >= make_timestamp(2018, 1, > 1, 0, 0, 0::double precision) AND < make_timestamp(2019, 1, > 1, 0, 0, 0::double precision) --000000000000e68ee30591aab503 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think I would expect this behavior with how you hav= e defined the constraints=C2=A0as the function results rather than just bei= ng strict comparisons to the timestamp=C2=A0field.

Instead of this-
Check constraints:
> =C2=A0 =C2=A0 "= y2018_mis_ora_check" CHECK (date_part('year'::text, mis_ora) = =3D
> 2018::double precision)

I would ex= pect this-
Check constraints:
> =C2=A0 =C2=A0 "y2018_m= is_ora_check" CHECK mis_ora) >=3D make_timestamp(2018, 1,
> 1= , 0, 0, 0::double precision) AND < make_timestamp(2019, 1,
> 1, 0,= 0, 0::double precision)
--000000000000e68ee30591aab503--