activerecord-cockroachdb-adapter 7.2.3 → 7.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 986b2d4c2759aab6b8bcae1ccaf58421331bb9049721394cd31e232614b05a22
4
- data.tar.gz: 44f28a2f9fffa398143219695ed56f8f9b25fff97624e4ea390dbe8bcae987bb
3
+ metadata.gz: c264b125195bc158e58aa652d8ef439fbdc0143906e89b36f4dde335b0d01a62
4
+ data.tar.gz: 30edfe2dcfd8c22c9e85e90a4b473321537f3f2c7360aa532e0a4828e5c51697
5
5
  SHA512:
6
- metadata.gz: e45d26b18980f9af81f1170cfea00eb94a95853597472b4261b3ff959732e8cc257727d1cbfe1948689a54fc536db1b79f28f6c056bfaade1af681407e4096bf
7
- data.tar.gz: 8e5a41b5197eda1143bb13cc93408eaadb707eb187ff4140894efba8b545c7a5a8c42ba857c5f42c572604ccb42dc1334fcf97f1a5bd1f543ac0f1941565be5e
6
+ metadata.gz: c16131d979e0786fe578d33f3f39e402c8dbe86c7b8c2d9a505ed6e54cdfc0de47b7a36913ae6fb5d626bd834083ce9f12a03c4656bf51e6e7088f63924944ec
7
+ data.tar.gz: ad0ebb869bd80919de447aab0ca459f7a40f87ca0a682f2939b4f17cbc98572fe2b542e214391acb2e592bcb1fe814cdd06e22678766d645a84585402072ae76
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.2.4 - 2026-08-19
4
+
5
+ - Detect cached plan failures by error message instead of source function, so recovery keeps working after CockroachDB moved where the error is raised ([#403](https://github.com/cockroachdb/activerecord-cockroachdb-adapter/pull/403))
6
+
3
7
  ## 7.2.3 - 2026-01-30
4
8
 
5
9
  - Disallow usage of ROLLBACK AND CHAIN syntax, which is not yet supported in CockroachDB ([#397](https://github.com/cockroachdb/activerecord-cockroachdb-adapter/pull/397))
@@ -449,24 +449,24 @@ module ActiveRecord
449
449
  end
450
450
 
451
451
  # override
452
- # This method is used to determine if a
453
- # FEATURE_NOT_SUPPORTED error from the PG gem should
454
- # be an ActiveRecord::PreparedStatementCacheExpired
455
- # error.
452
+ # Classifies a FEATURE_NOT_SUPPORTED error from the PG gem as an
453
+ # ActiveRecord::PreparedStatementCacheExpired.
456
454
  #
457
- # ActiveRecord handles this by checking that the sql state matches the
458
- # FEATURE_NOT_SUPPORTED code and that the source function
459
- # is "RevalidateCachedQuery" since that is the only function
460
- # in postgres that will create this error.
461
- #
462
- # That method will not work for CockroachDB because the error
463
- # originates from the "runExecBuilder" function, so we need
464
- # to modify the original to match the CockroachDB behavior.
455
+ # Upstream matches PG_DIAG_SOURCE_FUNCTION == "RevalidateCachedQuery",
456
+ # the one PostgreSQL C function that raises this error. CockroachDB's
457
+ # raising function is an internal detail that has already moved
458
+ # (runExecBuilder before cockroachdb/cockroach#164406, execBind after),
459
+ # so match the message instead. The message is not formally guaranteed,
460
+ # but it has been unchanged in PostgreSQL since 8.3 and drivers such as
461
+ # pgx assert the exact string. Upstream avoids message matching because
462
+ # PostgreSQL localizes messages via lc_messages (rails/rails@d507ae2a74);
463
+ # CockroachDB does not localize, so that concern does not apply.
464
+ CACHED_PLAN_HEURISTIC = "cached plan must not change result type"
465
465
  def is_cached_plan_failure?(e)
466
466
  pgerror = e.cause
467
467
 
468
468
  pgerror.result.result_error_field(PG::PG_DIAG_SQLSTATE) == FEATURE_NOT_SUPPORTED &&
469
- pgerror.result.result_error_field(PG::PG_DIAG_SOURCE_FUNCTION) == "runExecBuilder"
469
+ pgerror.result.result_error_field(PG::PG_DIAG_MESSAGE_PRIMARY).include?(CACHED_PLAN_HEURISTIC)
470
470
  rescue
471
471
  false
472
472
  end
data/lib/version.rb CHANGED
@@ -15,5 +15,5 @@
15
15
  # limitations under the License.
16
16
 
17
17
  module ActiveRecord
18
- COCKROACH_DB_ADAPTER_VERSION = "7.2.3"
18
+ COCKROACH_DB_ADAPTER_VERSION = "7.2.4"
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-cockroachdb-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.3
4
+ version: 7.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cockroach Labs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-30 00:00:00.000000000 Z
11
+ date: 2026-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord