Skip to content

Audit AbstractAdapter supports_* capability flags for Oracle accuracy #2728

@yahonda

Description

@yahonda

Background

Active Record's AbstractAdapter declares many supports_*? capability flags that adapters override to advertise feature support. Recently merged PRs (#2715, #2717, #2724, #2727; the in-flight #2726) showed a recurring pattern: the underlying Oracle feature was already implemented in oracle-enhanced for years, but the capability flag stayed at the AbstractAdapter default (false). The flag mismatch caused Rails core to take alternative paths or AR-level tests to skip Oracle paths needlessly.

For #2727 (supports_expression_index?), the entire library change was three lines:

def supports_expression_index?
  true
end

The dumper, the visitor, and the structure_dump path were all already wired correctly. The flag had simply not been updated to match.

Proposal

Do a systematic audit of every supports_*? method on ActiveRecord::ConnectionAdapters::AbstractAdapter (and at least the PG/MySQL overrides for comparison), and for each:

  1. Classify Oracle's actual support: supported / unsupported / partial.
  2. Compare against current oracle-enhanced override state.
  3. File targeted PRs for any flag where Oracle does support the feature but oracle-enhanced reports false (or vice-versa).

Known state (post-recent PRs)

Already overridden to true:

Intentionally false:

Candidate flags to audit

Some that are likely already supported but possibly not flipped:

  • supports_bulk_alter? — Oracle supports multiple operations in one ALTER TABLE
  • supports_comments? / supports_comments_in_create?COMMENT ON TABLE / COMMENT ON COLUMN work
  • supports_datetime_with_precision? — TIMESTAMP(n) supported
  • supports_disable_referential_integrity?ALTER TABLE DISABLE CONSTRAINT exists
  • supports_explain? — Oracle has EXPLAIN PLAN
  • supports_foreign_keys? — obviously
  • supports_indexes_in_create? — Oracle's CREATE TABLE accepts inline UNIQUE constraints (and the constraint-creates-index pattern); needs a closer look
  • supports_insert_conflict_target? / supports_insert_on_duplicate_skip? / supports_insert_on_duplicate_update? — Oracle's MERGE and INSERT ... ON CONFLICT-equivalents
  • supports_json? — Oracle has JSON column type (12c+)
  • supports_lazy_transactions? — needs verification
  • supports_materialized_views?CREATE MATERIALIZED VIEW exists
  • supports_savepoints?SAVEPOINT works
  • supports_set_constraints?SET CONSTRAINTS DEFERRED works
  • supports_transaction_isolation?SET TRANSACTION ISOLATION LEVEL exists
  • supports_transactional_indexes? — needs verification
  • supports_table_comments? — see comments above

Likely PG-only (should stay false on Oracle):

  • supports_extensions? — PG-specific
  • supports_foreign_tables? — PG-specific (FDW)
  • supports_index_include? — PG-specific (INCLUDE (col) syntax)
  • supports_nulls_not_distinct? — PG 15+ specific
  • supports_partitioned_tables? — Oracle has partitioning but the AR flag may target PG semantics specifically
  • supports_string_aggregation? — needs check; Oracle has LISTAGG

Approach

  1. For each flag, write a small probe: what does AR core do behind the flag? Is the Oracle equivalent already wired up in oracle-enhanced?
  2. Group findings into:
  3. Open small PRs per flag (one PR per flag is the established pattern from Override supports_index_sort_order? to true #2726 / Override supports_expression_index? to true #2727).

Why now

After a survey of recent PRs there's a clear pattern of "the work was done years ago, the flag never caught up". A focused audit pass closes that gap and lets multi-DB Rails apps that target Oracle as a secondary backend get fewer if connection.adapter_name == 'OracleEnhanced' escape hatches.

Surfaced during the survey for #2702 / #2710; the audit is a sibling to issues #2711 (closed by #2726/#2727), #2712 (closed: stays false), #2713 (stored generated columns), #2714 (closed: prepared cache).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions