File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
tools/greenplum-to-pg-tests/cmd Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -474,10 +474,14 @@ type ReplacePair struct {
474
474
To string
475
475
}
476
476
477
- var schemaTableRegexp = regexp .MustCompile (`(?i)(CREATE TABLE|FROM|INSERT INTO|JOIN|UPDATE)\s+"?([^\s."]+)"?\."?([^\s."]+)"?` )
477
+ var (
478
+ schemaTableRegexp = regexp .MustCompile (`(?is)(EXISTS|FROM|INSERT INTO|JOIN|\s+ON|ROOTPARTITION|TABLE|UPDATE)\s+"?([^\s."]+)"?\."?([^\s."]+)"?` )
479
+ schemaTableField = regexp .MustCompile (`"?([^\s."]+)"?\."?([^\s."]+)"?\."?([^\s."]+)"?` )
480
+ )
478
481
479
482
func fixSchemaNames (queryText string ) string {
480
483
queryText = schemaTableRegexp .ReplaceAllString (queryText , "${1} ${2}___${3}" )
484
+ queryText = schemaTableField .ReplaceAllString (queryText , "${1}___${2}.${3}" )
481
485
return queryText
482
486
}
483
487
Original file line number Diff line number Diff line change @@ -22,6 +22,22 @@ FROM asd___sss t
22
22
USING "kkk" AS base
23
23
WHERE` ,
24
24
},
25
+ {
26
+ from : `LOCK TABLE "asd"."ffa" IN EXCLUSIVE MODE` ,
27
+ result : `LOCK TABLE asd___ffa IN EXCLUSIVE MODE` ,
28
+ },
29
+ {
30
+ from : `DROP TABLE IF EXISTS "aaa"."bbb"` ,
31
+ result : `DROP TABLE IF EXISTS aaa___bbb` ,
32
+ },
33
+ {
34
+ from : `GRANT SELECT ON sss.tt to public` ,
35
+ result : `GRANT SELECT ON sss___tt to public` ,
36
+ },
37
+ {
38
+ from : `SELECT s.t.f FROM s.t` ,
39
+ result : `SELECT s___t.f FROM s___t` ,
40
+ },
25
41
}
26
42
27
43
for i , test := range table {
You can’t perform that action at this time.
0 commit comments