activerecord-cockroachdb-adapter 7.2.2 → 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: 913fb9d4adb774cede984f4e707dab5cd49cea139d2195e11319a12b719b195c
4
- data.tar.gz: 2d721a7f241acd3e9bf18bca828d493e81b35d327f5601c28fab52a9280dd21f
3
+ metadata.gz: c264b125195bc158e58aa652d8ef439fbdc0143906e89b36f4dde335b0d01a62
4
+ data.tar.gz: 30edfe2dcfd8c22c9e85e90a4b473321537f3f2c7360aa532e0a4828e5c51697
5
5
  SHA512:
6
- metadata.gz: 83a959c8c01067449bca7d723c90c2bbaebe15072102e214141204bda3720f9cb9b88ce354af5e084a62759c1da2361276a80e69a09da0d4316e0d8024b38956
7
- data.tar.gz: c2f2d1e0d28ec926f635495dd840de5a0b288c7828a29bf2d72914f664e80cdb280d1253dc17f107da63df037036dd3145586cc6f4dc54f0a58f68990d1880d8
6
+ metadata.gz: c16131d979e0786fe578d33f3f39e402c8dbe86c7b8c2d9a505ed6e54cdfc0de47b7a36913ae6fb5d626bd834083ce9f12a03c4656bf51e6e7088f63924944ec
7
+ data.tar.gz: ad0ebb869bd80919de447aab0ca459f7a40f87ca0a682f2939b4f17cbc98572fe2b542e214391acb2e592bcb1fe814cdd06e22678766d645a84585402072ae76
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
7
+ ## 7.2.3 - 2026-01-30
8
+
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))
10
+
3
11
  ## 7.2.2 - 2025-08-20
4
12
 
5
13
  - Fixed the handling of column comments that end in a single quote ([#384](https://github.com/cockroachdb/activerecord-cockroachdb-adapter/pull/384))
@@ -208,6 +208,11 @@ module ActiveRecord
208
208
  false
209
209
  end
210
210
 
211
+ def supports_restart_db_transaction?
212
+ # Restart -> PG's ROLLBACK AND CHAIN
213
+ false
214
+ end
215
+
211
216
  def supports_deferrable_constraints?
212
217
  # https://go.crdb.dev/issue-v/31632/v23.1
213
218
  false
@@ -444,24 +449,24 @@ module ActiveRecord
444
449
  end
445
450
 
446
451
  # override
447
- # This method is used to determine if a
448
- # FEATURE_NOT_SUPPORTED error from the PG gem should
449
- # be an ActiveRecord::PreparedStatementCacheExpired
450
- # error.
451
- #
452
- # ActiveRecord handles this by checking that the sql state matches the
453
- # FEATURE_NOT_SUPPORTED code and that the source function
454
- # is "RevalidateCachedQuery" since that is the only function
455
- # in postgres that will create this error.
452
+ # Classifies a FEATURE_NOT_SUPPORTED error from the PG gem as an
453
+ # ActiveRecord::PreparedStatementCacheExpired.
456
454
  #
457
- # That method will not work for CockroachDB because the error
458
- # originates from the "runExecBuilder" function, so we need
459
- # 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"
460
465
  def is_cached_plan_failure?(e)
461
466
  pgerror = e.cause
462
467
 
463
468
  pgerror.result.result_error_field(PG::PG_DIAG_SQLSTATE) == FEATURE_NOT_SUPPORTED &&
464
- 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)
465
470
  rescue
466
471
  false
467
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.2"
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.2
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: 2025-08-20 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