Creating a tablespace in postgresql

后端 未结 2 1800
遥遥无期
遥遥无期 2021-02-12 19:24

I\'m trying to create a tablespace in postgres, but I\'m getting ownership problems. The command I\'m using is:

CREATE TABLESPACE magdat OWNER maggie LOCATION \'         


        
2条回答
  •  醉梦人生
    2021-02-12 20:26

    When you install Postgres on a Mac, and are trying to use PgAdmin to create your databases, tablespaces, etc. You need to know that the PgAdmin Utility is running under the postgres account that it created when you installed the postgres database and the utilities.

    The postgres account is part of the _postgres group

    ( dscacheutil -q group|grep -i postgres command will list the group associated with the postgres account)

    The best practice would be to create a new directory under root(/) for housing the tablespaces,(let us call it /postgresdata then make postgres:_postgres the owners of that directory, using the command below)

    sudo chown postgres:_postgres /postgresdata

    This should do it for you. You could then create a subdirectory under /postgresdata for each unique table space

提交回复
热议问题