Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: ignore store option (#10578)

rebelicefeca9f45f71a
diff --git a/backend/plugin/parser/plsql/concise_test.go b/backend/plugin/parser/plsql/concise_test.go
index 216cd1b756..81f9e92105 100644
--- a/backend/plugin/parser/plsql/concise_test.go
+++ b/backend/plugin/parser/plsql/concise_test.go
@@ -17,7 +17,7 @@ type conciseTestCase struct {
func TestConciseSchema(t *testing.T) {
tests := []conciseTestCase{}
const (
- record = true
+ record = false
)
var (
filepath = "test-data/test_concise_schema.yaml"
diff --git a/backend/plugin/parser/plsql/replace.go b/backend/plugin/parser/plsql/replace.go
index e620b2ae81..a11a64d824 100644
--- a/backend/plugin/parser/plsql/replace.go
+++ b/backend/plugin/parser/plsql/replace.go
@@ -41,6 +41,22 @@ type eraseListener struct {
rewriter antlr.TokenStreamRewriter
}
+func (l *eraseListener) EnterRelational_table(ctx *parser.Relational_tableContext) {
+ if l.ctx.eraseStoreOption {
+ if ctx.RIGHT_PAREN() != nil {
+ start := ctx.RIGHT_PAREN().GetSymbol().GetTokenIndex() + 1
+ stop := ctx.GetStop().GetTokenIndex()
+ if start > stop {
+ return
+ }
+ l.rewriter.DeleteDefault(
+ start,
+ stop,
+ )
+ }
+ }
+}
+
func (l *eraseListener) EnterTableview_name(ctx *parser.Tableview_nameContext) {
if l.ctx.eraseSchemaName && ctx.Id_expression() != nil {
l.rewriter.DeleteDefault(
@@ -92,6 +108,17 @@ func (l *eraseListener) EnterCreate_index(ctx *parser.Create_indexContext) {
}
}
+func (l *eraseListener) EnterTable_index_clause(ctx *parser.Table_index_clauseContext) {
+ if l.ctx.eraseStoreOption {
+ if ctx.Index_properties() != nil {
+ l.rewriter.DeleteDefault(
+ ctx.Index_properties().GetStart().GetTokenIndex(),
+ ctx.Index_properties().GetStop().GetTokenIndex(),
+ )
+ }
+ }
+}
+
func getNormalizeIndexName(ctx *parser.Create_indexContext) string {
var buf strings.Builder
// table name as prefix
diff --git a/backend/plugin/parser/plsql/test-data/test_concise_schema.yaml b/backend/plugin/parser/plsql/test-data/test_concise_schema.yaml
index d84f2ba7ac..8a33a7beca 100644
--- a/backend/plugin/parser/plsql/test-data/test_concise_schema.yaml
+++ b/backend/plugin/parser/plsql/test-data/test_concise_schema.yaml
@@ -14,10 +14,29 @@
salary NUMBER(10,2),
department_id NUMBER(3),
CONSTRAINT fk_employee_department FOREIGN KEY (department_id) REFERENCES BYTEBASE.departments(department_id)
- );
+ )
+ LOGGING
+ NOCOMPRESS
+ PCTFREE 10
+ INITRANS 1
+ STORAGE (
+ INITIAL 65536
+ )
+ NOCACHE
+ DISABLE ROW MOVEMENT
+ ;
-- Create an index on the combination of columns in the employees table
CREATE INDEX idx_employee_name_department ON BYTEBASE.employees(last_name, first_name, department_id);
- CREATE INDEX idx_employee_name ON BYTEBASE.employees(last_name, first_name);
+ CREATE INDEX idx_employee_name ON BYTEBASE.employees(last_name, first_name)
+ LOGGING
+ VISIBLE
+ PCTFREE 10
+ INITRANS 2
+ STORAGE (
+ INITIAL 65536
+ )
+ USABLE
+ ;
want: |+
CREATE TABLE departments (
department_id NUMBER(3) PRIMARY KEY,
@@ -33,9 +52,13 @@
salary NUMBER(10,2),
department_id NUMBER(3),
FOREIGN KEY (department_id) REFERENCES departments(department_id)
- );
+ )
+ ;
CREATE INDEX "EMPLOYEES_0230" ON employees(last_name, first_name, department_id);
- CREATE INDEX "EMPLOYEES_0220" ON employees(last_name, first_name);
+ CREATE INDEX "EMPLOYEES_0221" ON employees(last_name, first_name)
+
+ USABLE
+ ;