Skip to content

Commit 453e536

Browse files
committed
fix broken table.field for join on
1 parent 8043947 commit 453e536

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tools/greenplum-to-pg-tests/cmd/check_pg_queries.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ type ReplacePair struct {
475475
}
476476

477477
var (
478-
schemaTableRegexp = regexp.MustCompile(`(?is)(EXISTS|FROM|INSERT INTO|JOIN|\s+ON|ROOTPARTITION|TABLE|UPDATE)\s+"?([^\s."]+)"?\."?([^\s."]+)"?`)
478+
schemaTableRegexp = regexp.MustCompile(`(?is)(EXISTS|FROM|INSERT INTO|JOIN|GRANT\s+\w+\s+ON|ROOTPARTITION|TABLE|UPDATE)\s+"?([^\s."]+)"?\."?([^\s."]+)"?`)
479479
schemaTableField = regexp.MustCompile(`"?([^\s."]+)"?\."?([^\s."]+)"?\."?([^\s."]+)"?`)
480480
)
481481

tools/greenplum-to-pg-tests/cmd/check_pg_queries_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ WHERE`,
3838
from: `SELECT s.t.f FROM s.t`,
3939
result: `SELECT s___t.f FROM s___t`,
4040
},
41+
{
42+
// no changes
43+
from: `select a.attname, a.atttypid, t.typname
44+
from pg_attribute a
45+
left outer join pg_type t on (a.atttypid = t.oid)
46+
where attrelid = 'pg_catalog.gp_id'::regclass and
47+
(attnum > 0 or attname='oid')
48+
order by attnum`,
49+
result: `select a.attname, a.atttypid, t.typname
50+
from pg_attribute a
51+
left outer join pg_type t on (a.atttypid = t.oid)
52+
where attrelid = 'pg_catalog.gp_id'::regclass and
53+
(attnum > 0 or attname='oid')
54+
order by attnum`,
55+
},
4156
}
4257

4358
for i, test := range table {

0 commit comments

Comments
 (0)