1

I have a Postgresql database that is running on premises which I want to import into Google Cloud SQL. My database is called test and is owned by user test

Steps I've taken:

  1. created Cloud SQL instance
  2. created database on Cloud SQL instance:

    curl --header "Authorization: Bearer XXXXX" \ --header 'Content-Type: application/json' \ --data '{"project": "YYYYYY", "instance": "dev", "name": "test"}' \

    https://www.googleapis.com/sql/v1beta4/projects/YYYYYY/instances/dev/databases -X POST

  3. Created test user:

    gcloud beta sql users create test host --instance=dev --password=test

  4. Dumped DB from source db with pg_dump
  5. Tried to restored ... got this error:
    ERROR: must be member of role test

So how do I execute import under test user?

1 Answer 1

6

To answer my own question...

Just use --no-acl --no-owner with pg_dump to remove all ownership altering, and it will work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.