Reputation: 1
I need to partition an existing table which is main.customer by year. The situation I have is that, I have a column that contains a string with year in it and I want to extract the year part from that string.
my sample query is..
CREATE TABLE main.customer_prtn (LIKE main.customer)
PARTITION BY RANGE (to_date(substring(ref_id,1,4),'YYYY'))
(START (date '2008') INCLUSIVE,
....
END (date '2015') EXCLUSIVE
EVERY (INTERVAL '1 year') );
When I run the query, i get the message
ERROR: syntax error at or near "("
LINE 2: PARTITION BY RANGE (to_date(substring(ref_id,1,4),'YYYY'))
Upvotes: 0
Views: 1197
Reputation: 246033
PostgreSQL doesn't have declarative partitioning yet (a patch for v10 is under review).
Read the documentation about partitioning to find out how it has to be done currently.
Upvotes: 1