Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: ignore column in FROM clause (#15880)
rebelice0772ac049880
diff --git a/backend/plugin/parser/tsql/completion.go b/backend/plugin/parser/tsql/completion.goindex c0c02feca2..0a83c69d23 100644--- a/backend/plugin/parser/tsql/completion.go+++ b/backend/plugin/parser/tsql/completion.go@@ -118,6 +118,12 @@ var (tsqlparser.TSqlParserRULE_full_table_name: true,tsqlparser.TSqlParserRULE_asterisk: true,tsqlparser.TSqlParserRULE_full_column_name: true,++ // The following rules are not used in the completion, we add them to the preferred rules to avoid deep recursion.+ // Ignore xml_data_type_methods to avoid column completion in FROM clause.+ tsqlparser.TSqlParserRULE_xml_data_type_methods: true,+ // Ignore nodes_method to avoid column completion in FROM clause.+ tsqlparser.TSqlParserRULE_nodes_method: true,})diff --git a/backend/plugin/parser/tsql/test-data/test_completion.yaml b/backend/plugin/parser/tsql/test-data/test_completion.yamlindex 4af280d051..dce6d39edb 100644--- a/backend/plugin/parser/tsql/test-data/test_completion.yaml+++ b/backend/plugin/parser/tsql/test-data/test_completion.yaml@@ -3,30 +3,6 @@select count(1) from t1 where id; SELECT * FROM |select * from QRTZ_J0B_DETAILS qjd where J0B_NAME like '%gray';want:- - text: EmployeeId- type: COLUMN- definition: Company.dbo.Address | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.dbo.Employees | int, NOT NULL- comment: ""- - text: Name- type: COLUMN- definition: Company.dbo.Employees | varchar, NOT NULL- comment: ""- - text: SalaryUpBound- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: Street- type: COLUMN- definition: Company.dbo.Address | varchar, NOT NULL- comment: ""- text: Companytype: DATABASEdefinition: ""@@ -51,10 +27,6 @@type: TABLEdefinition: ""comment: ""- - text: qjd- type: TABLE- definition: ""- comment: ""- description: Column alias can be used in order by clauseinput: SELECT Id AS IdAlias, Name FROM Employees ORDER BY |;want:@@ -241,14 +213,6 @@- description: Completion should not consider CTE if no schema specifiedinput: WITH MyCTE_01 AS (SELECT * FROM dbo.Employees) SELECT * FROM MySchema.|want:- - text: Id- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: SalaryUpBound- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- text: SalaryLeveltype: TABLEdefinition: ""@@ -256,30 +220,6 @@- description: Completion should consider CTE if no schema specifiedinput: WITH MyCTE_01 AS (SELECT * FROM dbo.Employees) SELECT * FROM |want:- - text: EmployeeId- type: COLUMN- definition: Company.dbo.Address | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.dbo.Employees | int, NOT NULL- comment: ""- - text: Name- type: COLUMN- definition: Company.dbo.Employees | varchar, NOT NULL- comment: ""- - text: SalaryUpBound- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: Street- type: COLUMN- definition: Company.dbo.Address | varchar, NOT NULL- comment: ""- text: Companytype: DATABASEdefinition: ""@@ -311,22 +251,6 @@- description: Completion table in specify schemainput: SELECT * FROM dbo.|want:- - text: EmployeeId- type: COLUMN- definition: Company.dbo.Address | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.dbo.Employees | int, NOT NULL- comment: ""- - text: Name- type: COLUMN- definition: Company.dbo.Employees | varchar, NOT NULL- comment: ""- - text: Street- type: COLUMN- definition: Company.dbo.Address | varchar, NOT NULL- comment: ""- text: Addresstype: TABLEdefinition: ""@@ -338,30 +262,6 @@- description: Completion table for simple selectinput: SELECT * FROM |want:- - text: EmployeeId- type: COLUMN- definition: Company.dbo.Address | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: Id- type: COLUMN- definition: Company.dbo.Employees | int, NOT NULL- comment: ""- - text: Name- type: COLUMN- definition: Company.dbo.Employees | varchar, NOT NULL- comment: ""- - text: SalaryUpBound- type: COLUMN- definition: Company.MySchema.SalaryLevel | int, NOT NULL- comment: ""- - text: Street- type: COLUMN- definition: Company.dbo.Address | varchar, NOT NULL- comment: ""- text: Companytype: DATABASEdefinition: ""