Re: can't create table on new db/schema/user

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: psql-contact(at)citecs(dot)de
Cc: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: can't create table on new db/schema/user
Date: 2020-08-28 10:56:12
Message-ID: 20200828105612.GB7316@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Aug 28, 2020 at 12:32:02PM +0200, psql-contact(at)citecs(dot)de wrote:
> postgres=# \dn+
> List of schemas
> Name | Owner | Access privileges | Description
> ---------+-------------+----------------------------+------------------------
> public | postgres | postgres=UC/postgres +| standard public schema
> | | =UC/postgres |
> s_chris | chris | chris=UC/chris |
> (3 rows)
>
> postgres=# \dg+
> List of roles
> Role name | Attributes | Member of | Description
> -------------+------------------------------------------------------------+-----------+-------------
> chris | | {} |
> postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |
>
> db_chris=> create table t1 (i int);
> ERROR: no schema has been selected to create in
> LINE 1: create table t1 (i int);
> ^
> db_chris=> \dn+
> List of schemas
> Name | Owner | Access privileges | Description
> --------+----------+----------------------+------------------------
> public | postgres | postgres=UC/postgres+| standard public schema
> | | =UC/postgres |
> (1 row)
>
> db_chris=> \dg+
> List of roles
> Role name | Attributes | Member of | Description
> -------------+------------------------------------------------------------+-----------+-------------
> chris | | {} |
> postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} |
>
> db_chris=> show search_path;
> search_path
> -------------
> s_chris
> (1 row)
> So, what did I miss?

Schema s_chris is in database "postgres", but you try to make the table
in "db_chris".

So you have to make the schema in db_chris database.

Best regards,

depesz

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message psql-contact 2020-08-28 11:28:35 Re: can't create table on new db/schema/user
Previous Message psql-contact 2020-08-28 10:32:02 can't create table on new db/schema/user