postgres icon indicating copy to clipboard operation
postgres copied to clipboard

postgresql stop on error and not import

Open tuliogalli opened this issue 10 years ago • 2 comments

good night, with the upgrade version https://github.com/docker-library/postgres/commit/916a840510b481e7d3f0f74fa04fde3edfdfbd04

I can no longer import my data, they stop at the first error.

How would I do to disable this option that was added at the last commit?   ON_ERROR_STOP = 1

thank you

tuliogalli avatar Feb 24 '16 22:02 tuliogalli

Most users wanted to error when there was a problem importing the sql. To work around it, just make a simple script to go with it:

# /docker-entrypoint-initdb.d/myscript.sh
#!/bin/bash
set -e

psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "my-custom-sql"

As long as your sql file does not end with ".sql", you can import it however you want.

yosifkit avatar Feb 24 '16 22:02 yosifkit

About ON_ERROR_STOP, I understand, thanks for the explanation.

About the script, thanks also worked perfectly.

Thank you for the quick response.

Finally congratulations to you and the team. This project is excellent.

tuliogalli avatar Feb 24 '16 22:02 tuliogalli