pgbus 0.21.3 → 0.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -2
- data/lib/pgbus/event.rb +10 -0
- data/lib/pgbus/pgmq_schema/fixups/pgmq_v1.13.1.sql +265 -0
- data/lib/pgbus/pgmq_schema/pgmq_v1.13.1.sql +2324 -0
- data/lib/pgbus/pgmq_schema.rb +34 -4
- data/lib/pgbus/version.rb +1 -1
- metadata +3 -1
data/lib/pgbus/pgmq_schema.rb
CHANGED
|
@@ -16,6 +16,23 @@ module Pgbus
|
|
|
16
16
|
SCHEMA_DIR = File.expand_path("pgmq_schema", __dir__).freeze
|
|
17
17
|
FIXUPS_DIR = File.join(SCHEMA_DIR, "fixups").freeze
|
|
18
18
|
|
|
19
|
+
# Wrapped around the vendored SQL by install_sql; see there.
|
|
20
|
+
SAVE_SEARCH_PATH_SQL = <<~SQL
|
|
21
|
+
DO $pgbus_save_path$
|
|
22
|
+
BEGIN
|
|
23
|
+
PERFORM pg_catalog.set_config('pgbus.install_saved_search_path', pg_catalog.current_setting('search_path'), true);
|
|
24
|
+
END
|
|
25
|
+
$pgbus_save_path$;
|
|
26
|
+
SQL
|
|
27
|
+
|
|
28
|
+
RESTORE_SEARCH_PATH_SQL = <<~SQL
|
|
29
|
+
DO $pgbus_restore_path$
|
|
30
|
+
BEGIN
|
|
31
|
+
PERFORM pg_catalog.set_config('search_path', pg_catalog.current_setting('pgbus.install_saved_search_path'), true);
|
|
32
|
+
END
|
|
33
|
+
$pgbus_restore_path$;
|
|
34
|
+
SQL
|
|
35
|
+
|
|
19
36
|
class << self
|
|
20
37
|
# Returns the latest vendored PGMQ version string.
|
|
21
38
|
def latest_version
|
|
@@ -78,11 +95,21 @@ module Pgbus
|
|
|
78
95
|
# Strips the extension-only pg_dump config blocks since they're
|
|
79
96
|
# irrelevant when not installed as an extension.
|
|
80
97
|
#
|
|
98
|
+
# From 1.13.1 upstream pins `search_path = pg_catalog, pg_temp` for the
|
|
99
|
+
# install with a transaction-local set_config, which outlives the install
|
|
100
|
+
# inside a migration (or a caller's transaction, in the client's lazy
|
|
101
|
+
# install): the next unqualified CREATE TABLE would target pg_catalog.
|
|
102
|
+
# The caller's path is saved before upstream's text and restored after,
|
|
103
|
+
# both transaction-local, so the install's pinning still applies to its
|
|
104
|
+
# own statements and nothing after them. Run the result as one string:
|
|
105
|
+
# a statement-by-statement load would lose the saved path between
|
|
106
|
+
# statements.
|
|
107
|
+
#
|
|
81
108
|
# @param version [String] defaults to latest
|
|
82
109
|
# @return [String] SQL
|
|
83
110
|
def install_sql(version = latest_version)
|
|
84
|
-
sql = sql_for_version(version)
|
|
85
|
-
|
|
111
|
+
sql = strip_extension_only_blocks(sql_for_version(version))
|
|
112
|
+
"#{SAVE_SEARCH_PATH_SQL}\n#{sql}\n#{RESTORE_SEARCH_PATH_SQL}"
|
|
86
113
|
end
|
|
87
114
|
|
|
88
115
|
# Returns SQL to create the version tracking table and record an installation.
|
|
@@ -231,9 +258,12 @@ module Pgbus
|
|
|
231
258
|
""
|
|
232
259
|
)
|
|
233
260
|
|
|
234
|
-
# Remove _belongs_to_pgmq function (checks pg_depend on extension)
|
|
261
|
+
# Remove _belongs_to_pgmq function (checks pg_depend on extension).
|
|
262
|
+
# From 1.13.1 its terminator carries `SET search_path = ...`; ending
|
|
263
|
+
# the match at a bare `LANGUAGE plpgsql;` would run on to the next
|
|
264
|
+
# function without that clause and strip everything in between.
|
|
235
265
|
sql.gsub(
|
|
236
|
-
/CREATE FUNCTION pgmq\._belongs_to_pgmq
|
|
266
|
+
/CREATE FUNCTION pgmq\._belongs_to_pgmq.*?\$\$\s*LANGUAGE plpgsql[^;]*;/m,
|
|
237
267
|
""
|
|
238
268
|
)
|
|
239
269
|
end
|
data/lib/pgbus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pgbus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.21.
|
|
4
|
+
version: 0.21.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mikael Henriksson
|
|
@@ -456,10 +456,12 @@ files:
|
|
|
456
456
|
- lib/pgbus/outbox/poller.rb
|
|
457
457
|
- lib/pgbus/pgmq_schema.rb
|
|
458
458
|
- lib/pgbus/pgmq_schema/fixups/pgmq_v1.13.0.sql
|
|
459
|
+
- lib/pgbus/pgmq_schema/fixups/pgmq_v1.13.1.sql
|
|
459
460
|
- lib/pgbus/pgmq_schema/pgmq_v1.11.0.sql
|
|
460
461
|
- lib/pgbus/pgmq_schema/pgmq_v1.11.1.sql
|
|
461
462
|
- lib/pgbus/pgmq_schema/pgmq_v1.12.0.sql
|
|
462
463
|
- lib/pgbus/pgmq_schema/pgmq_v1.13.0.sql
|
|
464
|
+
- lib/pgbus/pgmq_schema/pgmq_v1.13.1.sql
|
|
463
465
|
- lib/pgbus/process/claim_buffer.rb
|
|
464
466
|
- lib/pgbus/process/consumer.rb
|
|
465
467
|
- lib/pgbus/process/consumer_priority.rb
|