”unique key“ cant not avoid duplicate date when unique column not same as partion column
when create a table which a is primary key and b is the partion key,datas can be inserted into table which datas on column a are same while on column b are different,it meaning that unique constraint does't work when same value insert into different nodes. As bellow:
test=> create table test_unique(a int primary key,b int) PARTITIONING KEY b ON ALL;
CREATE TABLE
Time: 198.650 ms
test=> insert into test_unique(a,b) values(1,1);
INSERT 0 1
Time: 1.650 ms
test=> insert into test_unique(a,b) values(1,2);
INSERT 0 1
Time: 31.033 ms
test=> exec direct on all 'select * from test_unique';
a | b | Node
---+---+------
1 | 2 | 2
1 | 1 | 3
(2 rows)
Time: 3.905 ms
What should do to make it work?
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Stado Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask tomas for more information if necessary.