0

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'))
1
  • You really should clarify your question! Commented Dec 7, 2016 at 10:59

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.