Skip to content

Commit 7d9a12f

Browse files
h3n4lclaude
authored andcommitted
fix(plsql): parse CREATE TABLE range bounds as expressions (BYT-9302) (#20042)
Bump github.com/bytebase/parser to pick up bytebase/parser#66, which closes a batch of CREATE TABLE grammar gaps against the Oracle 19c spec. Directly unblocks BYT-9302: PARTITION BY RANGE ... INTERVAL (NUMTODSINTERVAL(...)) (... VALUES LESS THAN (DATE '...')) now parses. Add the reported fixture as a regression test in TestPLSQLParser. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> (cherry picked from commit e5c1c91)
1 parent 6d6bdd9 commit 7d9a12f

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

backend/plugin/parser/plsql/plsql_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,23 @@ func TestPLSQLParser(t *testing.T) {
4242
statement: "SELECT 1 FROM DUAL;\n SELEC 5 FROM DUAL;\nSELECT 6 FROM DUAL;",
4343
errorMessage: "Syntax error at line 2:10 \nrelated text: SELECT 1 FROM DUAL;\n SELEC 5",
4444
},
45+
// BYT-9302: CREATE TABLE with INTERVAL partitioning and DATE literal bound.
46+
{
47+
statement: `CREATE TABLE GCP.LEAD_DROP_MC_NATIVE_DATA
48+
(
49+
TXN_DATE DATE,
50+
USERID VARCHAR2(100),
51+
CUSTID VARCHAR2(100),
52+
SCREENID VARCHAR2(500),
53+
EVENTTIME DATE,
54+
STATUS NUMBER
55+
)
56+
PARTITION BY RANGE (TXN_DATE)
57+
INTERVAL (NUMTODSINTERVAL(1,'DAY'))
58+
(
59+
PARTITION P0 VALUES LESS THAN (DATE '2026-01-01')
60+
);`,
61+
},
4562
}
4663

4764
for _, test := range tests {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ require (
298298
github.com/aws/aws-sdk-go-v2/service/sts v1.41.8
299299
github.com/aws/smithy-go v1.24.2 // indirect
300300
github.com/beorn7/perks v1.0.1 // indirect
301-
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50
301+
github.com/bytebase/parser v0.0.0-20260417075056-57b6ef7a2640
302302
github.com/cespare/xxhash/v2 v2.3.0 // indirect
303303
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect
304304
github.com/cockroachdb/cockroach-go/v2 v2.4.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0 h1:bJ8NSf2K+
253253
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0/go.mod h1:BEWMfiZtqshdmulKJcIsWb45MUaEvDO4CROcgi8dfFg=
254254
github.com/bytebase/omni v0.0.0-20260417040020-724d3998950a h1:jSeJxacP5ZJzvIZwddyX5N0OP9hR87SOGnht3HdX9B4=
255255
github.com/bytebase/omni v0.0.0-20260417040020-724d3998950a/go.mod h1:AT+iLKCu7NyxTaYaOLzETRFBVurjRaqUU3YmFron9pw=
256-
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50 h1:Kq5wlhZ586Rch39y/IQV9MnrEzHob4iiXBG6zrbvSMU=
257-
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50/go.mod h1:jeak/EfutSOAuWKvrFIT2IZunhWprM7oTFBRgZ9RCxo=
256+
github.com/bytebase/parser v0.0.0-20260417075056-57b6ef7a2640 h1:g4Jed1/Jv/DHBiQmEgN5ILOQDDBjFlG4N4Lp+3B4aYE=
257+
github.com/bytebase/parser v0.0.0-20260417075056-57b6ef7a2640/go.mod h1:jeak/EfutSOAuWKvrFIT2IZunhWprM7oTFBRgZ9RCxo=
258258
github.com/bytebase/pgx/v5 v5.0.0-20250212161523-96ff8aed8767 h1:YuR5G3LcxpO5ScSTA+Kdirxg9RW4TRc/v1t7N2Hfmbw=
259259
github.com/bytebase/pgx/v5 v5.0.0-20250212161523-96ff8aed8767/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
260260
github.com/bytebase/pkcs8 v0.0.0-20240612095628-fcd0a7484c94 h1:6PNsuNmSqCuR8Z616uQLzDIvujWCFsKzeVc3ECmVubk=

0 commit comments

Comments
 (0)