Avoid updating inactive_since for invalid replication slots.
[pgsql.git] / contrib / lo / expected / lo.out
blob2c9c07f783092885167efa146b10d980ab5f385e
1 CREATE EXTENSION lo;
2 CREATE TABLE image (title text, raster lo);
3 CREATE TRIGGER t_raster BEFORE UPDATE OR DELETE ON image
4     FOR EACH ROW EXECUTE PROCEDURE lo_manage(raster);
5 SELECT lo_create(43213);
6  lo_create 
7 -----------
8      43213
9 (1 row)
11 SELECT lo_create(43214);
12  lo_create 
13 -----------
14      43214
15 (1 row)
17 INSERT INTO image (title, raster) VALUES ('beautiful image', 43213);
18 SELECT lo_get(43213);
19  lo_get 
20 --------
21  \x
22 (1 row)
24 SELECT lo_get(43214);
25  lo_get 
26 --------
27  \x
28 (1 row)
30 UPDATE image SET raster = 43214 WHERE title = 'beautiful image';
31 SELECT lo_get(43213);
32 ERROR:  large object 43213 does not exist
33 SELECT lo_get(43214);
34  lo_get 
35 --------
36  \x
37 (1 row)
39 -- test updating of unrelated column
40 UPDATE image SET title = 'beautiful picture' WHERE title = 'beautiful image';
41 SELECT lo_get(43214);
42  lo_get 
43 --------
44  \x
45 (1 row)
47 DELETE FROM image;
48 SELECT lo_get(43214);
49 ERROR:  large object 43214 does not exist
50 -- Now let's try it with an AFTER trigger
51 DROP TRIGGER t_raster ON image;
52 CREATE CONSTRAINT TRIGGER t_raster AFTER UPDATE OR DELETE ON image
53     DEFERRABLE INITIALLY DEFERRED
54     FOR EACH ROW EXECUTE PROCEDURE lo_manage(raster);
55 SELECT lo_create(43223);
56  lo_create 
57 -----------
58      43223
59 (1 row)
61 SELECT lo_create(43224);
62  lo_create 
63 -----------
64      43224
65 (1 row)
67 SELECT lo_create(43225);
68  lo_create 
69 -----------
70      43225
71 (1 row)
73 INSERT INTO image (title, raster) VALUES ('beautiful image', 43223);
74 SELECT lo_get(43223);
75  lo_get 
76 --------
77  \x
78 (1 row)
80 UPDATE image SET raster = 43224 WHERE title = 'beautiful image';
81 SELECT lo_get(43223);  -- gone
82 ERROR:  large object 43223 does not exist
83 SELECT lo_get(43224);
84  lo_get 
85 --------
86  \x
87 (1 row)
89 -- test updating of unrelated column
90 UPDATE image SET title = 'beautiful picture' WHERE title = 'beautiful image';
91 SELECT lo_get(43224);
92  lo_get 
93 --------
94  \x
95 (1 row)
97 -- this case used to be buggy
98 BEGIN;
99 UPDATE image SET title = 'beautiful image' WHERE title = 'beautiful picture';
100 UPDATE image SET raster = 43225 WHERE title = 'beautiful image';
101 SELECT lo_get(43224);
102  lo_get 
103 --------
104  \x
105 (1 row)
107 COMMIT;
108 SELECT lo_get(43224);  -- gone
109 ERROR:  large object 43224 does not exist
110 SELECT lo_get(43225);
111  lo_get 
112 --------
113  \x
114 (1 row)
116 DELETE FROM image;
117 SELECT lo_get(43225);  -- gone
118 ERROR:  large object 43225 does not exist
119 SELECT lo_oid(1::lo);
120  lo_oid 
121 --------
122       1
123 (1 row)
125 DROP TABLE image;