From 38637fa646f26b008e8218b4d3b760502f89a482 Mon Sep 17 00:00:00 2001 From: Zhengda Lu Date: Tue, 10 Oct 2023 15:43:11 -0400 Subject: [PATCH] add test case to cover quoted identifier --- obfuscate_and_normalize_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/obfuscate_and_normalize_test.go b/obfuscate_and_normalize_test.go index 0cef867..843ceb9 100644 --- a/obfuscate_and_normalize_test.go +++ b/obfuscate_and_normalize_test.go @@ -156,6 +156,31 @@ multiline comment */ Size: 12, }, }, + { + // double quoted table name + input: `SELECT * FROM "public"."users" WHERE id = 1`, + expected: `SELECT * FROM "public"."users" WHERE id = ?`, + statementMetadata: StatementMetadata{ + Tables: []string{`"public"."users"`}, + Comments: []string{}, + Commands: []string{"SELECT"}, + Size: 22, + }, + }, + { + // [] quoted table name + input: `SELECT * FROM [public].[users] WHERE id = 1`, + expected: `SELECT * FROM [public].[users] WHERE id = ?`, + statementMetadata: StatementMetadata{ + Tables: []string{"[public].[users]"}, + Comments: []string{}, + Commands: []string{"SELECT"}, + Size: 22, + }, + lexerOpts: []lexerOption{ + WithDBMS(DBMSSQLServer), + }, + }, } obfuscator := NewObfuscator(