Cannot use meta function or non-deterministic function in PARTITION BY expression
Hi all,
I want to create table, partitioned by days of month. I've tried alter table MY_TABLE_NAME partition by extract(DAY from starttime)::INT reorganize; but had ROLLBACK 2552: Cannot use meta function or non-deterministic function in PARTITION BY expression. What is the problem? Thanks!
0
Comments
Hi,
Can you check the data type of starttime? Is it timestamptz? if so, changing it to timestamp will work. Since timestamptz value changes according to the locale. All the expressions in Paritition by clause must be immutable. meaning that they return the exact same value regardless of when they are invoked, and independently of session or environment settings, such as LOCALE.
-Regards,
Sruthi
Thank you! You are right, it's timestamp with timezone. Do you meant something like this?
Hi,
Yeah, I meant the create table should be like the following
Thanks very much!