-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbloqueos.sql
24 lines (20 loc) · 854 Bytes
/
bloqueos.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
drop table compra;
CREATE TABLE compra (
usuario varchar(15) NOT NULL,
libro varchar(15) NOT NULL,
precio money NOT NULL,
CONSTRAINT pk_compra PRIMARY KEY (usuario, libro),
CONSTRAINT fk_compra_usuario FOREIGN KEY (usuario) REFERENCES usuario(login),
CONSTRAINT fk_compra_libro FOREIGN KEY (libro) REFERENCES libro(isbn)
);
INSERT INTO COMPRA (usuario, libro, precio) VALUES ('mike', '9781593272838', '15.99');
SELECT t_xmin, t_xmax FROM heap_page_items(get_raw_page('compra', 0));
DELETE FROM compra;
INSERT INTO COMPRA (usuario, libro, precio) VALUES ('mike', '9781593272838', '15.99');
SELECT t_xmin, t_xmax FROM heap_page_items(get_raw_page('compra', 0));
BEGIN WORK;
DELETE FROM compra;
SELECT xmin, xmax, * FROM compra;
\! psql -h localhost -d biblioteca -e -c "SELECT xmin, xmax, * FROM compra;"
SELECT txid_current();
COMMIT WORK;