No, it's unfortunately not possible. Documentation says in Caveats part: /Constraint exclusion only works when the query's WHERE clause contains constants (or externally supplied parameters). For example, a comparison against a non-immutable function such as CURRENT_TIMESTAMP cannot be optimized, since the planner cannot know which partition the function value might fall into at run time.
Keep the partitioning constraints simple, else the planner may not be able to prove that partitions don't need to be visited. Use simple equality conditions for list partitioning, or simple range tests for range partitioning, as illustrated in the preceding examples. A good rule of thumb is that partitioning constraints should contain only comparisons of the partitioning column(s) to constants using B-tree-indexable operators./ Even making a function in SQL or plpgsql and declaring it as immutable will not help. Postgres will always check against all the partitions. It's not enough "simple" for the planner. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html