Re: Partition prune with stable Expr - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Partition prune with stable Expr
Date
Msg-id CAKU4AWoyY6-_KMEKKbm8Oi9DtZDf4wkxq31ouSZ9o79zOhRdGw@mail.gmail.com
Whole thread Raw
In response to Re: Partition prune with stable Expr  (Thomas Kellerer <shammat@gmx.net>)
List pgsql-hackers


On Mon, Sep 28, 2020 at 9:17 PM Thomas Kellerer <shammat@gmx.net> wrote:
Andy Fan schrieb am 28.09.2020 um 02:54:
> Well, that's very interesting.  Specific to my user case, 
> SELECT * FROM p WHERE pkey = to_date('2018-12-13', 'yyyy-mm-dd)';

Why use to_date() at all for a constant value?
Can't you use a standard ANSI date literal (date '2018-12-13')?


This is from lots of legacy code from Oracle and the real case is 
to_date('20181213', 'yyyymmdd'). 

Alternatively, you could use make_date(2018,12,13) which is marked as immutable.


Thanks, Nice to know make_date function. 

--
Best Regards
Andy Fan

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Planner making bad choice in alternative subplan decision
Next
From: David Rowley
Date:
Subject: Re: Small improvements to pg_list.h's linitial(), lsecond(), lthird() etc macros