Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[colocated] Truncate on colocated table is not removing records properly #11043

Closed
Arjun-yb opened this issue Jan 10, 2022 · 1 comment
Closed
Assignees

Comments

@Arjun-yb
Copy link
Contributor

Arjun-yb commented Jan 10, 2022

Truncate table is not removing records properly with colocated DB/table
DB Version: 2.11.2.0-b54
Steps:

  1. Create colocated database and table.
  2. Load some data
  3. Create unique index.
  4. Truncate table
  5. Read data from table
  6. Load same data again and observe the behaviour.

ex:

yugabyte=# CREATE DATABASE colocated_db colocated = true;
CREATE DATABASE
yugabyte=# \c colocated_db;
You are now connected to database "colocated_db" as user "yugabyte".
colocated_db=# CREATE TABLE col_temp_tbl (h INT PRIMARY KEY) WITH (colocated = true);
CREATE TABLE
colocated_db=# INSERT INTO col_temp_tbl VALUES (1), (2), (3);
INSERT 0 3
colocated_db=# create unique index on col_temp_tbl(h);
CREATE INDEX
colocated_db=# truncate col_temp_tbl;
TRUNCATE TABLE
colocated_db=# SELECT * from col_temp_tbl;
 h 
---
(0 rows)

colocated_db=# INSERT INTO col_temp_tbl VALUES (1), (2), (3);
ERROR:  duplicate key value violates unique constraint "col_temp_tbl_h_idx"
@frozenspider
Copy link
Contributor

Closing as a duplicate of #10912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants