How to select a schema in postgres when using psql?

前端 未结 9 916
死守一世寂寞
死守一世寂寞 2021-01-29 18:11

I have a postgres database with multiple schemas. When I connect to the database from a shell with psql and I run \\dt it uses the default connection s

9条回答
  •  庸人自扰
    2021-01-29 19:02

    This is old, but I put exports in my alias for connecting to the db:

    alias schema_one.con="PGOPTIONS='--search_path=schema_one' psql -h host -U user -d database etc"
    

    And for another schema:

    alias schema_two.con="PGOPTIONS='--search_path=schema_two' psql -h host -U user -d database etc"
    

提交回复
热议问题