Using \set for psql doesn't work
I can't seem to use \set
or any psql command that is prefixed with \
. As far as I can tell, goose works with psql as a dialect, so I'm a little confused especially since the actual error I'm getting is a pq error: (pq: syntax error at or near "\"). I tried to escape the slash by doing: \\set
, but that didn't work.
Either an explanation or a fix would be helpful.
I am looking at lib/goose/migration_sql.go
on line 99, trying to see if I can find anything, but all I'm really seeing in that function is that every statement should end with a semicolon, even if the actual psql query doesn't require it.
Comments (2)
-
-
Although it is unsatisfying, I think I found an answer: https://github.com/purcell/sqlint/issues/10
Basically, it seems backslash commands aren't proper sql commands and therefore can't be passed to the PostgreSQL server.
Not 100% sure what that means exactly as I can still say something like:
psql <other options> -a -f xxx.sql
while having the \set command in that file, but it does seem to affect the Exec statement that goose uses. - Log in to comment
Created an account now.
What version of psql is being run? I can copy and paste the exact query that is being run in
lib/goose/migration_sql.go
on line 156 and get no error.