0

I'm trying to dump a .sql file into a PostgresSQL database and it's acting kinda funky. I've followed a lot of the advice here (Import SQL dump into PostgreSQL database) and thought I got close. Whenever I try something like:

psql -h localhost -d db_name -U postgres -f sql_file.sql

It starts to work, but then I start to get a bunch of errors in a row like

psql:sql_file.sql:42: error: invalid command \'s
psql:sql_file.sql:43: error: invalid command \'t
psql:sql_file.sql:44: error: invalid command \'s

With that final invalid command changing to different strings on the end there. Is it not understanding some escape characters and instead trying to use them as commands in psql? If so, how do I avoid this? Eventually the dump terminated with:

psql:sql_file.sql:2281: error: out of memory

It is a rather large sql file (about 150GB). Am I going about this the wrong way? Any advice?

jarlh
  • 42,561
  • 8
  • 45
  • 63
jeepers mcface
  • 371
  • 1
  • 5
  • 15
  • `psql` understands escapes when they are used correctly. Here they apparently are not used correctly. Look at line 42 of sql_file.sql and see what the problem is. What created this dump file? – jjanes Feb 24 '21 at 15:05
  • 1
    If it is a valid PostgreSQL .sql dump then it should work. You wouldn't dump a database in that format normally though, you would use the "custom" format with "-Fc" it is compressed and lets you pick out parts to restore etc. If you want more precise advice you will need to show the first 42 lines of the file so we can see where the error is. – Richard Huxton Feb 24 '21 at 15:08
  • @jjanes I got it from here (https://steam.internet.byu.edu/), so maybe it was made using a different SQL option like MySQL or something? So I guess the answer to my question is--it is not properly formatted for PostgreSQL – jeepers mcface Feb 24 '21 at 20:10
  • Yeah, the first line shows it to be from mysql. – jjanes Feb 24 '21 at 22:32

0 Answers0