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 11package compiler
22
33import (
4+ "bufio"
45 "errors"
56 "fmt"
67 "io"
@@ -38,6 +39,7 @@ func (c *Compiler) parseCatalog(schemas []string) error {
3839 continue
3940 }
4041 contents := migrations .RemoveRollbackStatements (string (blob ))
42+ contents = removePsqlMetaCommands (contents )
4143 c .schema = append (c .schema , contents )
4244 stmts , err := c .parser .Parse (strings .NewReader (contents ))
4345 if err != nil {
@@ -57,6 +59,19 @@ func (c *Compiler) parseCatalog(schemas []string) error {
5759 return nil
5860}
5961
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+
6075func (c * Compiler ) parseQueries (o opts.Parser ) (* Result , error ) {
6176 var q []* Query
6277 merr := multierr .New ()
Original file line number Diff line number Diff line change 55-- Dumped from database version 15.3 (Debian 15.3-1.pgdg120+1)
66-- Dumped by pg_dump version 15.3
77
8+ \restrict auwherpfqaiuwrhgp
9+
810SET statement_timeout = 0 ;
911SET lock_timeout = 0 ;
1012SET idle_in_transaction_session_timeout = 0 ;
You can’t perform that action at this time.
0 commit comments