Error importing postgres DB dump into empty database

1.6k views Asked by At

I need to import my psql dump into my fresh psql database. When I execute the following command, I get errors.

psql -U user new_database < filename.sql

Error I got:

ERROR: out of memory DETAIL: Cannot enlarge string buffer containing 0 bytes by 1208975751 more bytes.

How do i fix this. Aldo, is there any method to log the import process?

Thanks.

1

There are 1 answers

0
Mike Sherrill 'Cat Recall' On

I think the most common cause is a "corrupt" SQL file. There's no easy fix. Split the file in half (man split), fix the SQL statements at the tail end of one resulting file and at the head end of the other, and run again. In the past, I seem to recall seeing "Invalid byte sequence for UTF-8", or something like that. I'm sure there are other causes.

PostgreSQL has a lot of logging options; set them in postgresql.conf and restart PostgreSQL. Look at

  • log_destination
  • logging_collector
  • client_min_messages
  • log_error_verbosity
  • log_statement