Skip to content

Commit eaa56d8

Browse files
committed
Fixed the table SQL so we only create tables (not views... they should be handled in a new views.go file)
1 parent 200082f commit eaa56d8

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

privilege.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
SELECT table_name
2+
FROM information_schema.tables
3+
WHERE table_schema = 'information_schema';
4+
5+
SELECT grantee, table_name, privilege_type, is_grantable, with_hierarchy
6+
FROM information_schema.table_privileges
7+
WHERE table_schema = 'public'
8+
ORDER BY table_name, privilege_type;
9+
10+
SELECT grantee, table_name, column_name, privilege_type, is_grantable
11+
FROM information_schema.column_privileges
12+
WHERE table_schema = 'public';

table.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ func (c TableSchema) Change(obj interface{}) {
5555
//fmt.Printf("Change Table? %s - %s\n", c.row["table_name"], c2.row["table_name"])
5656
}
5757

58-
/*
59-
* Compare the tables in the two databases
60-
*/
58+
// compareTables outputs SQL to make the table names match between DBs
6159
func compareTables(conn1 *sql.DB, conn2 *sql.DB) {
6260
sql := `
6361
SELECT table_name
6462
, table_type
6563
, is_insertable_into
6664
FROM information_schema.tables
6765
WHERE table_schema = 'public'
66+
AND table_type = 'BASE TABLE'
6867
ORDER by table_name;`
6968

7069
rowChan1, _ := pgutil.QueryStrings(conn1, sql)

0 commit comments

Comments
 (0)