1 -- Test basic TRUNCATE functionality.
2 CREATE TABLE truncate_a (col1 integer primary key);
3 NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'truncate_a_pkey' for table 'truncate_a'
4 INSERT INTO truncate_a VALUES (1);
5 INSERT INTO truncate_a VALUES (2);
6 SELECT * FROM truncate_a;
14 SELECT * FROM truncate_a;
19 -- Test foreign constraint check
20 CREATE TABLE truncate_b(col1 integer references truncate_a);
21 NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
22 INSERT INTO truncate_a VALUES (1);
23 SELECT * FROM truncate_a;
30 ERROR: TRUNCATE cannot be used as other tables reference this one via foreign key constraint $1
31 SELECT * FROM truncate_a;
37 DROP TABLE truncate_b;
38 DROP TABLE truncate_a;