Strip precision from TIMESTAMP data types in %ROWTYPE fields#253
Strip precision from TIMESTAMP data types in %ROWTYPE fields#253yahonda merged 1 commit intorsim:masterfrom
Conversation
9782223 to
e4a6641
Compare
There was a problem hiding this comment.
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 ZONEtoTIMESTAMP WITH LOCAL TIME ZONEwhen building%ROWTYPEfield metadata fromALL_TAB_COLUMNS. - Add an RSpec that creates a table with a
TIMESTAMP WITH LOCAL TIME ZONEcolumn and asserts normalized field metadata for a%ROWTYPEfunction 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.
There was a problem hiding this comment.
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 ZONEtoTIMESTAMP WITH LOCAL TIME ZONEwhile building%ROWTYPEfield definitions. - Add an RSpec regression test covering a
%ROWTYPEparameter with aTIMESTAMP WITH LOCAL TIME ZONEcolumn.
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.
e4a6641 to
8636ce4
Compare
There was a problem hiding this comment.
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%ROWTYPEfielddata_typevalues inPLSQL::Procedure#get_field_definitions. - Add a spec covering normalization for
TIMESTAMP,TIMESTAMP WITH TIME ZONE, andTIMESTAMP WITH LOCAL TIME ZONEfields in a%ROWTYPEargument.
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>
8636ce4 to
e4be2f2
Compare
There was a problem hiding this comment.
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%ROWTYPEfielddata_typevalues when reading table/view column metadata inProcedure#get_field_definitions. - Add an RSpec that asserts
TIMESTAMP,TIMESTAMP WITH TIME ZONE, andTIMESTAMP WITH LOCAL TIME ZONEare normalized (precision removed) for%ROWTYPEfields.
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.
Summary
ALL_TAB_COLUMNS.DATA_TYPEincludes 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)get_field_definitionsto match the exact strings expected by type mapping inoci_connection.rb,jdbc_connection.rb, andprocedure_call.rbtable.rb:data_type.sub(/\(\d+\)/, "")Based on #208
Test plan
testworkflow passes (Oracle 23c Free)test_11gworkflow passes (Oracle 11g XE)TIMESTAMP,TIMESTAMP WITH TIME ZONE,TIMESTAMP WITH LOCAL TIME ZONECo-Authored-By: Jochen Schug 4573581+joschug@users.noreply.github.com
🤖 Generated with Claude Code