Skip to content

Unable to create relations with schema other than postgres #1014

@neelasha-09

Description

@neelasha-09

Hi Team,

We are creating the schema: a3sschema with user- a3s and database - a3sdb.
Below is the configuration used to deploy the cluster ,

spec:
  numberOfInstances: 1
  patroni:
    pg_hba:
    - host    all all 0.0.0.0/0 md5
  postgresql:
    version: "12"
  preparedDatabases:
    a3sdb:
      defaultRoles: false
      defaultUsers: false
      schemas:
        a3sschema:
          defaultRoles: false
          defaultUsers: false
  resources:
    limits:
      cpu: 500m
      memory: 500Mi
    requests:
      cpu: 10m
      memory: 100Mi
  teamId: postgres
  tls:
    secretName: ""
  users:
    a3suser:
    - createdb
  volume:
    size: 1Gi

Upon connecting to the database with a3suser user and a3sdb database we create a table.
However we see the table is created with the public schema and not the a3sschema which was created during deployment.

Please see logs below:

a3sdb=> CREATE TABLE student (
a3sdb(>     name            varchar(80),
a3sdb(>     location        point
a3sdb(> );
CREATE TABLE
a3sdb=>
a3sdb=> \dt
         List of relations
 Schema |  Name   | Type  |  Owner
--------+---------+-------+---------
 public | student | table | a3suser
(1 row)

Also we see the numerous roles created even after setting the defaultRoles: false

a3sdb=> \du
                                                                                List of roles
       Role name        |                         Attributes                         |                                       Member of
------------------------+------------------------------------------------------------+---------------------------------------------------------------------------------------
 a3sdb_a3sschema_owner  | Cannot login                                               | {a3sdb_a3sschema_reader,a3sdb_a3sschema_writer}
 a3sdb_a3sschema_reader | Cannot login                                               | {}
 a3sdb_a3sschema_writer | Cannot login                                               | {a3sdb_a3sschema_reader}
 a3sdb_owner            | Cannot login                                               | {a3sdb_a3sschema_owner,a3sdb_reader,a3sdb_writer,a3sdb_reader_user,a3sdb_writer_user}
 a3sdb_owner_user       |                                                            | {a3sdb_owner}
 a3sdb_reader           | Cannot login                                               | {}
 a3sdb_reader_user      |                                                            | {a3sdb_reader}
 a3sdb_writer           | Cannot login                                               | {a3sdb_reader}
 a3sdb_writer_user      |                                                            | {a3sdb_writer}
 a3suser                | Create DB                                                  | {}
 admin                  | Create DB, Cannot login                                    | {a3sdb_owner,a3suser,a3sdb_owner_user}
 postgres               | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 robot_zmon             | Cannot login                                               | {}
 standby                | Replication                                                | {}
 zalandos               | Create DB, Cannot login                                    | {}

We need you support in order to understand how do we create the relations in our database with our created schema and not the public schema.
Also how do we eliminate the extra roles despite setting the values to "false"

Thanks,
Regards
Neelam Sharma

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions