0

I am wondering how to partition a table like,

  • from 0 to 100
  • from 100 to 200
  • 200 and above
CREATE TABLE grade_main 
(
    id serial not null, 
    g int not null
) partition by range (g);

CREATE TABLE grade_00_100 PARTITION OF grade_main FOR VALUES FROM (0) TO (100);
CREATE TABLE grade_100_200 PARTITION OF grade_main FOR VALUES FROM (100) TO (200);

-- The following returns syntax error

CREATE TABLE grade_150_all PARTITION OF grade_main FOR VALUES FROM (150);

1 Answer 1

2

To soecify a range that has no upper limit, use

FOR VALUES FROM (150) TO (MAXVALUE)
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.