Repository navigation
feat: parse Oracle RAW(n) and NUMBER(*, s) data types - #2875
Merged
manticore-projects merged 1 commit intoOct 31, 2026
Merged
manticore-projects merged 1 commit into
manticore-projects merged 1 commit into
Conversation
DDL exported from Oracle with DBMS_METADATA.GET_DDL prints an INTEGER column as NUMBER(*,0) and binary columns as RAW(16). CREATE TABLE and ALTER TABLE with such columns failed to parse, and so did CAST(x AS NUMBER(*,0)) and CAST(x AS RAW(16)). RAW is a keyword token, so ColDataType did not accept it as a type name. NUMBER(*, s) now takes the same path as NUMBER(p, s): DataType() accepts * in its precision slot for NUMBER only, and ColDataType folds it into the type name as "NUMBER (*, 0)" with a null precision and the scale set. NUMBER(*, *) and VARCHAR(*) stay rejected.
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DDL exported from Oracle with
DBMS_METADATA.GET_DDLspells anINTEGERcolumn asNUMBER(*,0), keepsNUMBER(*,2)as written, and prints binary columns asRAW(16). None of these parse on master, neither in column definitions nor asCASTtargets:Oracle 21c accepts all of them:
CREATE TABLE t (a NUMBER(*,0), b NUMBER(*), c RAW(16), d INTEGER, e NUMBER(*,2))succeeds, and so does theSELECTabove. A downstream consumer parsing such exports ran into both.RAWis a non-reserved keyword token thatColDataType()did not list among its type-name tokens. It is listed now, soRAW(16)is handled like any other identifier type with a length argument, and the otherK_RAWuses (FOR XML RAW, DDL parameter lists) are untouched.NUMBER(*, s)takes the same path asNUMBER(p, s)rather than the generic argument list thatVECTOR(*, *)uses since #2845:DataType()accepts*in its precision slot, forNUMBERonly, andColDataTypefolds it into the type name the way it folds a numeric precision. The scale stays a scale, so both spellings expose the same shape:The scale slot is unchanged, so
NUMBER(*, *)is rejected, andVARCHAR(*)andNUMERIC(3, *)are rejected as before. Neither form is gated on the Oracle dialect;checkGrammarAmbiguityreports no conflicts.Tests:
ColDataTypeTest.testOracleNumberWithWildcardPrecisionandtestOracleRawTypecover theCREATE TABLE,ALTER TABLE ADDandCASTround trips and theNUMBER(*, *)rejection. Both failed with the errors above before the grammar change.