Debian Codegraph @

src/test/isolation/expected/temp-schema-cleanup.out

raw
1 Parsed test spec with 2 sessions
2
3 starting permutation: s1_create_temp_objects s1_discard_temp s2_check_schema
4 step s1_create_temp_objects:
5
6 -- create function large enough to be toasted, to ensure we correctly clean those up, a prior bug
7 -- https://postgr.es/m/CAOFAq3BU5Mf2TTvu8D9n_ZOoFAeQswuzk7yziAb7xuw_qyw5gw%40mail.gmail.com
8 SELECT exec(format($outer$
9 CREATE OR REPLACE FUNCTION pg_temp.long() RETURNS text LANGUAGE sql AS $body$ SELECT %L; $body$$outer$,
10 (SELECT string_agg(g.i::text||':'||random()::text, '|') FROM generate_series(1, 100) g(i))));
11
12 -- The above bug requires function removal to happen after a catalog
13 -- invalidation. dependency.c sorts objects in descending oid order so
14 -- that newer objects are deleted before older objects, so create a
15 -- table after.
16 CREATE TEMPORARY TABLE invalidate_catalog_cache();
17
18 -- test non-temp function is dropped when depending on temp table
19 CREATE TEMPORARY TABLE just_give_me_a_type(id serial primary key);
20
21 CREATE FUNCTION uses_a_temp_type(just_give_me_a_type) RETURNS int LANGUAGE sql AS $$SELECT 1;$$;
22
23 exec
24 ----
25
26 (1 row)
27
28 step s1_discard_temp:
29 DISCARD TEMP;
30
31 step s2_check_schema:
32 SELECT oid::regclass FROM pg_class WHERE relnamespace = (SELECT oid FROM s1_temp_schema);
33 SELECT oid::regproc FROM pg_proc WHERE pronamespace = (SELECT oid FROM s1_temp_schema);
34 SELECT oid::regproc FROM pg_type WHERE typnamespace = (SELECT oid FROM s1_temp_schema);
35
36 oid
37 ---
38 (0 rows)
39
40 oid
41 ---
42 (0 rows)
43
44 oid
45 ---
46 (0 rows)
47
48
49 starting permutation: s1_advisory s2_advisory s1_create_temp_objects s1_exit s2_check_schema
50 step s1_advisory:
51 SELECT pg_advisory_lock('pg_namespace'::regclass::int8);
52
53 pg_advisory_lock
54 ----------------
55
56 (1 row)
57
58 step s2_advisory:
59 SELECT pg_advisory_lock('pg_namespace'::regclass::int8);
60 <waiting ...>
61 step s1_create_temp_objects:
62
63 -- create function large enough to be toasted, to ensure we correctly clean those up, a prior bug
64 -- https://postgr.es/m/CAOFAq3BU5Mf2TTvu8D9n_ZOoFAeQswuzk7yziAb7xuw_qyw5gw%40mail.gmail.com
65 SELECT exec(format($outer$
66 CREATE OR REPLACE FUNCTION pg_temp.long() RETURNS text LANGUAGE sql AS $body$ SELECT %L; $body$$outer$,
67 (SELECT string_agg(g.i::text||':'||random()::text, '|') FROM generate_series(1, 100) g(i))));
68
69 -- The above bug requires function removal to happen after a catalog
70 -- invalidation. dependency.c sorts objects in descending oid order so
71 -- that newer objects are deleted before older objects, so create a
72 -- table after.
73 CREATE TEMPORARY TABLE invalidate_catalog_cache();
74
75 -- test non-temp function is dropped when depending on temp table
76 CREATE TEMPORARY TABLE just_give_me_a_type(id serial primary key);
77
78 CREATE FUNCTION uses_a_temp_type(just_give_me_a_type) RETURNS int LANGUAGE sql AS $$SELECT 1;$$;
79
80 exec
81 ----
82
83 (1 row)
84
85 step s1_exit:
86 SELECT pg_terminate_backend(pg_backend_pid());
87
88 FATAL: terminating connection due to administrator command
89 server closed the connection unexpectedly
90 This probably means the server terminated abnormally
91 before or while processing the request.
92
93 step s2_advisory: <... completed>
94 pg_advisory_lock
95 ----------------
96
97 (1 row)
98
99 step s2_check_schema:
100 SELECT oid::regclass FROM pg_class WHERE relnamespace = (SELECT oid FROM s1_temp_schema);
101 SELECT oid::regproc FROM pg_proc WHERE pronamespace = (SELECT oid FROM s1_temp_schema);
102 SELECT oid::regproc FROM pg_type WHERE typnamespace = (SELECT oid FROM s1_temp_schema);
103
104 oid
105 ---
106 (0 rows)
107
108 oid
109 ---
110 (0 rows)
111
112 oid
113 ---
114 (0 rows)
115