Niranjan
Niranjan

Reputation: 57

Can I add same value for range partition in PostgreSQL-12?

CREATE TABLE tbl_prop_demand_dtls_mango 
PARTITION OF tbl_prop_demand_dtls_partition
FOR VALUES FROM (28) TO (28);

I got this error

ERROR:  empty range bound specified for partition "tbl_prop_demand_dtls_mango"
DETAIL:  Specified lower bound ('28') is greater than or equal to upper bound ('28').

Upvotes: 0

Views: 1314

Answers (1)

klin
klin

Reputation: 121634

Per the documentation:

When creating a range partition, the lower bound specified with FROM is an inclusive bound, whereas the upper bound specified with TO is an exclusive bound.

The declaration

CREATE TABLE tbl_prop_demand_dtls_mango 
PARTITION OF tbl_prop_demand_dtls_partition
FOR VALUES FROM (28) TO (29);

defines a range for values greater or equal to 28 and less than 29. If the column is integer then the range contains only 28.

Upvotes: 2

Related Questions