@@ -66,6 +66,7 @@ const char *PROGRAM_VERSION = "unknown";
66
66
* https://github.com/reorg/pg_repack/issues/1
67
67
* d. open transactions/locks existing on other databases than the actual
68
68
* processing relation (except for locks on shared objects)
69
+ * e. VACUUMs which are always executed outside transaction blocks.
69
70
*
70
71
* Note, there is some redundancy in how the filtering is done (e.g. excluding
71
72
* based on pg_backend_pid() and application_name), but that shouldn't hurt
@@ -84,6 +85,8 @@ const char *PROGRAM_VERSION = "unknown";
84
85
" AND l.pid NOT IN (pg_backend_pid(), $1) " \
85
86
" AND (l.virtualxid, l.virtualtransaction) <> ('1/1', '-1/0') " \
86
87
" AND (a.application_name IS NULL OR a.application_name <> $2)" \
88
+ " AND a.query !~* E'^\\\\s*vacuum\\\\s+' " \
89
+ " AND a.query !~ E'^autovacuum: ' " \
87
90
" AND ((d.datname IS NULL OR d.datname = current_database()) OR l.database = 0)"
88
91
89
92
#define SQL_XID_SNAPSHOT_90000 \
@@ -97,6 +100,8 @@ const char *PROGRAM_VERSION = "unknown";
97
100
" AND l.pid NOT IN (pg_backend_pid(), $1) " \
98
101
" AND (l.virtualxid, l.virtualtransaction) <> ('1/1', '-1/0') " \
99
102
" AND (a.application_name IS NULL OR a.application_name <> $2)" \
103
+ " AND a.query !~* E'^\\\\s*vacuum\\\\s+' " \
104
+ " AND a.query !~ E'^autovacuum: ' " \
100
105
" AND ((d.datname IS NULL OR d.datname = current_database()) OR l.database = 0)"
101
106
102
107
/* application_name is not available before 9.0. The last clause of
@@ -111,6 +116,8 @@ const char *PROGRAM_VERSION = "unknown";
111
116
" ON a.datid = d.oid " \
112
117
" WHERE l.locktype = 'virtualxid' AND l.pid NOT IN (pg_backend_pid(), $1)" \
113
118
" AND (l.virtualxid, l.virtualtransaction) <> ('1/1', '-1/0') " \
119
+ " AND a.query !~* E'^\\\\s*vacuum\\\\s+' " \
120
+ " AND a.query !~ E'^autovacuum: ' " \
114
121
" AND ((d.datname IS NULL OR d.datname = current_database()) OR l.database = 0)" \
115
122
" AND ($2::text IS NOT NULL)"
116
123
0 commit comments