pgi 1.3.0 → 1.3.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/VERSION +1 -1
  4. data/lib/pgi/connection.rb +10 -0
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aaeef1f9122b07670f59222c36843277e90a7fcdefcf0fc38b4dfd7bd4367e2
4
- data.tar.gz: ae093a0e4a47f07df4539f4c95d43144ea04442f8e493272ff5f33247ffe9aea
3
+ metadata.gz: fed6426755c81717b19c965b3cdfb0063055d7a079a9422a7c63a1da6c0ea2f0
4
+ data.tar.gz: 16f727729774256b7dfa0de2f693d8ee324b7aa1702ef5a690fcce9778ec3e6e
5
5
  SHA512:
6
- metadata.gz: 3ebcbc320d7ae3450b3cca79d9c8ff56ff48c62d40fc5d6fe84ec968191e75147933f42fcaeb891dbfe821bc59ac95aa264c9f2d66793950e110828c5c1e653c
7
- data.tar.gz: 1c367dd6f3018cba2b8f203a061ef107d056df1e4e947c14c4f770042d48553f143a90bb26acd3e2f73aa18cb1d664cb518fca4f333451c442bf96037148d5ac
6
+ metadata.gz: adaa23894959c446cfe97ac48624dc0f51be999bbfe9931d858225691fcee4ce01183bf7b79602e554d729e628f4947f746aff4a6c3b2ed69764c7c8928e1dc0
7
+ data.tar.gz: 6958c45e9efffec55b0f364f0d5ef50cad86bb0c2e63cc616608f6780fb9752be712b4742650f975b6cb1a30bf7dfa3c3345f50c5de58b972a6ed4e4390e2740
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.3.1 (2026-10-30)
4
+
5
+ - **A stale prepared statement is planned again** — `#exec_stmt` deallocates
6
+ and re-prepares a statement that Postgres refuses with `cached plan must not
7
+ change result type` (a `SELECT *` after an `ALTER TABLE` under a running
8
+ process) and retries once, instead of raising until the process restarts.
9
+
3
10
  ## 1.3.0 (2026-10-30)
4
11
 
5
12
  - **A sort-only projection collision raises** — a read that sorts on a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -56,12 +56,22 @@ module PGI
56
56
  return @conn.exec_params(sql, params)
57
57
  end
58
58
 
59
+ replanned = false
59
60
  begin
60
61
  @conn.exec_prepared(stmt_name, params)
61
62
  rescue PG::InvalidSqlStatementName
62
63
  @logger&.debug "Creating missing prepared statement: \"#{stmt_name}\""
63
64
  @conn.prepare(stmt_name, sql)
64
65
  retry
66
+ rescue PG::FeatureNotSupported => e
67
+ # The table changed shape under a running process (ALTER TABLE): plan again, once
68
+ raise if replanned || !e.message.include?("cached plan must not change result type")
69
+
70
+ @logger&.debug "Re-preparing stale statement: \"#{stmt_name}\""
71
+ @conn.exec("DEALLOCATE #{@conn.quote_ident(stmt_name)}")
72
+ @conn.prepare(stmt_name, sql)
73
+ replanned = true
74
+ retry
65
75
  end
66
76
  rescue PG::Error => e
67
77
  # Log at the source so failures are traceable regardless of how the
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coherify