Skip to content

Strip precision from TIMESTAMP data types in %ROWTYPE fields#253

Merged
yahonda merged 1 commit intorsim:masterfrom
yahonda:remap-timestamp-ltz
Apr 13, 2026
Merged

Strip precision from TIMESTAMP data types in %ROWTYPE fields#253
yahonda merged 1 commit intorsim:masterfrom
yahonda:remap-timestamp-ltz

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented Apr 13, 2026

Summary

  • ALL_TAB_COLUMNS.DATA_TYPE includes precision for TIMESTAMP and INTERVAL types (e.g., TIMESTAMP(6) WITH LOCAL TIME ZONE) even when declared without explicit precision (Oracle includes the default precision since at least 11g)
  • Strip precision in get_field_definitions to match the exact strings expected by type mapping in oci_connection.rb, jdbc_connection.rb, and procedure_call.rb
  • Uses the same approach as table.rb: data_type.sub(/\(\d+\)/, "")

Based on #208

Test plan

  • Verify test workflow passes (Oracle 23c Free)
  • Verify test_11g workflow passes (Oracle 11g XE)
  • New test verifies all three TIMESTAMP variants are normalized: TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE

Co-Authored-By: Jochen Schug 4573581+joschug@users.noreply.github.com

🤖 Generated with Claude Code

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR normalizes Oracle dictionary-reported column types for %ROWTYPE fields so that TIMESTAMP(n) WITH LOCAL TIME ZONE (as reported by Oracle 18c+) is remapped to the library’s expected canonical TIMESTAMP WITH LOCAL TIME ZONE, preventing downstream type-mapping/conversion mismatches.

Changes:

  • Remap TIMESTAMP(n) WITH LOCAL TIME ZONE to TIMESTAMP WITH LOCAL TIME ZONE when building %ROWTYPE field metadata from ALL_TAB_COLUMNS.
  • Add an RSpec that creates a table with a TIMESTAMP WITH LOCAL TIME ZONE column and asserts normalized field metadata for a %ROWTYPE function parameter.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
spec/plsql/procedure_spec.rb Adds regression coverage asserting %ROWTYPE field type normalization for TIMESTAMP WITH LOCAL TIME ZONE.
lib/plsql/procedure.rb Normalizes ALL_TAB_COLUMNS.data_type for TIMESTAMP(n) WITH LOCAL TIME ZONE to the canonical form used by the type-mapping logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Normalizes Oracle metadata for %ROWTYPE fields so ALL_TAB_COLUMNS.DATA_TYPE values like TIMESTAMP(6) WITH LOCAL TIME ZONE are remapped to the standard TIMESTAMP WITH LOCAL TIME ZONE, avoiding downstream type-mapping/conversion issues when procedure metadata is consumed.

Changes:

  • Remap TIMESTAMP(n) WITH LOCAL TIME ZONE to TIMESTAMP WITH LOCAL TIME ZONE while building %ROWTYPE field definitions.
  • Add an RSpec regression test covering a %ROWTYPE parameter with a TIMESTAMP WITH LOCAL TIME ZONE column.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
spec/plsql/procedure_spec.rb Adds a regression spec validating TIMESTAMP WITH LOCAL TIME ZONE normalization in %ROWTYPE fields.
lib/plsql/procedure.rb Introduces data type normalization for TIMESTAMP(n) WITH LOCAL TIME ZONE in %ROWTYPE field metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yahonda yahonda force-pushed the remap-timestamp-ltz branch from e4a6641 to 8636ce4 Compare April 13, 2026 12:42
@yahonda yahonda changed the title Remap TIMESTAMP(n) WITH LOCAL TIME ZONE to standard form Strip precision from TIMESTAMP data types in %ROWTYPE fields Apr 13, 2026
@yahonda yahonda requested a review from Copilot April 13, 2026 12:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR normalizes Oracle %ROWTYPE field data_type strings by stripping default precision from ALL_TAB_COLUMNS.DATA_TYPE for TIMESTAMP (and related) columns so downstream type mapping matches expected canonical type names.

Changes:

  • Strip (\d+) precision from %ROWTYPE field data_type values in PLSQL::Procedure#get_field_definitions.
  • Add a spec covering normalization for TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE fields in a %ROWTYPE argument.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
spec/plsql/procedure_spec.rb Adds coverage to ensure %ROWTYPE TIMESTAMP variants are normalized to canonical type strings.
lib/plsql/procedure.rb Normalizes %ROWTYPE field data_type by removing numeric precision parentheses to align with existing type mapping expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ALL_TAB_COLUMNS.DATA_TYPE includes precision for TIMESTAMP and
INTERVAL types (e.g., TIMESTAMP(6) WITH LOCAL TIME ZONE) even when
declared without explicit precision. Strip it to match the exact
strings expected by type mapping in oci_connection.rb, jdbc_connection.rb,
and procedure_call.rb.

Uses the same approach as table.rb: data_type.sub(/\(\d+\)/, "")

Co-Authored-By: Jochen Schug <4573581+joschug@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR normalizes Oracle %ROWTYPE field metadata so TIMESTAMP column types reported by ALL_TAB_COLUMNS.DATA_TYPE match the exact strings expected by the library’s type mapping layers.

Changes:

  • Strip (\d+) precision from %ROWTYPE field data_type values when reading table/view column metadata in Procedure#get_field_definitions.
  • Add an RSpec that asserts TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE are normalized (precision removed) for %ROWTYPE fields.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/plsql/procedure.rb Normalizes %ROWTYPE field data_type by removing precision suffixes from ALL_TAB_COLUMNS.DATA_TYPE.
spec/plsql/procedure_spec.rb Adds regression coverage for TIMESTAMP variants in %ROWTYPE fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yahonda yahonda merged commit c3fa632 into rsim:master Apr 13, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants