Git Product home page Git Product logo

Comments (8)

tomera-cyera avatar tomera-cyera commented on July 17, 2024 1

@LaurentGoderre, yes. you see I need to initialize the db to have a postgres role even when the datadir already exists (a.k.a the db already initialized)

from postgres.

tianon avatar tianon commented on July 17, 2024

If you want a solution that does something with a started database (like our existing initdb scripts do), see #173, #821, #191, #929 for some other issues that have some good thoughts / suggestions (one of which this is probably a duplicate of).

from postgres.

tomera-cyera avatar tomera-cyera commented on July 17, 2024

Hi @tianon! Thanks for your response.
I managed to run an init script on my db but it fails with role "postgres" does not exist (it was probably deleted).
I don't know what roles the db has and I want to use the init script to verify the postgres role exists (and if not to create one).

from postgres.

LaurentGoderre avatar LaurentGoderre commented on July 17, 2024

You can run

docker exec -u postgres -it postgres psql    
psql (16.2 (Debian 16.2-1.pgdg120+2))
Type "help" for help.

postgres=# \du
                             List of roles
 Role name |                         Attributes                         
-----------+------------------------------------------------------------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS

from postgres.

tomera-cyera avatar tomera-cyera commented on July 17, 2024

Hi @LaurentGoderre unfortunately your solution would not work in my case because there is no role postgres so I'm unable to execute any command with -u postgres, that's why I would like to init the db with a postgres role creation

from postgres.

LaurentGoderre avatar LaurentGoderre commented on July 17, 2024

@tomera-cyera I believe postgres in this case refers to the OS user which is postgres not the db role.

from postgres.

tomera-cyera avatar tomera-cyera commented on July 17, 2024

No, I refer to the postgres db role in case I initialize the container with data-dir that does not have the role postgres I want to make sure the postgres role will be created if not exist
@LaurentGoderre

from postgres.

LaurentGoderre avatar LaurentGoderre commented on July 17, 2024

OOh you mean at initialization?

from postgres.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.