File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
endtoend/testdata/pg_dump Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
package compiler
2
2
3
3
import (
4
+ "bufio"
4
5
"errors"
5
6
"fmt"
6
7
"io"
@@ -38,6 +39,7 @@ func (c *Compiler) parseCatalog(schemas []string) error {
38
39
continue
39
40
}
40
41
contents := migrations .RemoveRollbackStatements (string (blob ))
42
+ contents = removePsqlMetaCommands (contents )
41
43
c .schema = append (c .schema , contents )
42
44
stmts , err := c .parser .Parse (strings .NewReader (contents ))
43
45
if err != nil {
@@ -57,6 +59,19 @@ func (c *Compiler) parseCatalog(schemas []string) error {
57
59
return nil
58
60
}
59
61
62
+ func removePsqlMetaCommands (contents string ) string {
63
+ s := bufio .NewScanner (strings .NewReader (contents ))
64
+ var lines []string
65
+ for s .Scan () {
66
+ line := s .Text ()
67
+ if strings .HasPrefix (line , `\` ) {
68
+ continue
69
+ }
70
+ lines = append (lines , line )
71
+ }
72
+ return strings .Join (lines , "\n " )
73
+ }
74
+
60
75
func (c * Compiler ) parseQueries (o opts.Parser ) (* Result , error ) {
61
76
var q []* Query
62
77
merr := multierr .New ()
Original file line number Diff line number Diff line change 5
5
-- Dumped from database version 15.3 (Debian 15.3-1.pgdg120+1)
6
6
-- Dumped by pg_dump version 15.3
7
7
8
+ \restrict auwherpfqaiuwrhgp
9
+
8
10
SET statement_timeout = 0 ;
9
11
SET lock_timeout = 0 ;
10
12
SET idle_in_transaction_session_timeout = 0 ;
You can’t perform that action at this time.
0 commit comments