File: dropped_column.sql

package info (click to toggle)
tablelog 0.6.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 244 kB
  • sloc: ansic: 1,284; sql: 708; makefile: 12; sh: 2
file content (31 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
BEGIN;

CREATE TABLE drop_test (
  id          SERIAL           NOT NULL
                               PRIMARY KEY,
  col1        VARCHAR(20)      NOT NULL
                               DEFAULT '',
  col2        VARCHAR(20)      NOT NULL
                               DEFAULT '',
  col3        VARCHAR(20)      NOT NULL
                               DEFAULT ''
);

-- init tablelog
SELECT table_log_init(5, 'public', 'drop_test', 'public', 'drop_test_log');

INSERT INTO drop_test (col1, col2, col3) VALUES ('a1', 'b1', 'c1');
SELECT * FROM drop_test;
SELECT * FROM drop_test_log;

ALTER TABLE drop_test DROP COLUMN col2;
ALTER TABLE drop_test_log DROP COLUMN col2;

INSERT INTO drop_test (col1, col3) VALUES ('a2', 'c2');
SELECT * FROM drop_test;
SELECT * FROM drop_test_log;


ROLLBACK;