Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add pg_dump --no-owner and --no-acl to avoid owner/permission issues #34689

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

rihardsgrislis
Copy link

Hey,

fcf175b changed PostgreSQL schema loading to use pg_restore but it fails when you dump schema on one computer and restore it on another (let's say one developer dumps schema, another one loads it) due to owner/permission issues (see below).
You can add --no-owner and --no-acl options to either pg_dump or pg_restore but I think it doesn't make sense to commit a schema with owners/permissions in the case (might be wrong, no problem to change - let me know).

Symfony\Component\Process\Exception\ProcessFailedException 

The command "PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_restore --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE $LARAVEL_LOAD_PATH" failed.

Exit Code: 1(General error)

Working directory: /Users/rihardssceredins/Code/api-diet

Output:
================

Error Output:
================
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 8; 2615 415790 SCHEMA public janisozolins
pg_restore: error: could not execute query: ERROR:  schema "public" already exists
Command was: CREATE SCHEMA public;

pg_restore: error: could not execute query: ERROR:  role "janisozolins" does not exist
Command was: ALTER SCHEMA public OWNER TO janisozolins;

pg_restore: from TOC entry 420; 1255 415886 FUNCTION datediff(character varying, timestamp without time zone, timestamp without time zone) janisozolins
pg_restore: error: could not execute query: ERROR:  role "janisozolins" does not exist

@rihardsgrislis
Copy link
Author

Setting those options on pg_restore would make sense to fix schema dump restoration for those who already upgraded to Laravel 8.8.0, but the release hasn't been marked as latest/release notes published. Let me know what option you think is best.

@taylorotwell taylorotwell merged commit af99030 into laravel:8.x Oct 5, 2020
@rihardsgrislis rihardsgrislis deleted the postgres-dump-no-owner branch October 6, 2020 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants