zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.38k stars 980 forks source link

could not create user \"app-new_public_owner\": pq: syntax error at or near \"-\"' #2745

Closed hvp1991 closed 1 month ago

hvp1991 commented 2 months ago

Please, answer some short questions which should help us to understand your problem / question better?

We are using zalando operator, However when we try to create database with special character in name (to be specific hyphen -), we do notice some errors in operator logs! In this example you can find db name is app-new

I do see credentials are getting created in zalando , However while syncing roles it gives specifically following error while creating role, The strange part is app-new_owner role and app-new_owner_user user got created but fails with reader, writer roles and users!

As per the code base special characters are allowed since queries are used with special character..!!

Error:

time="2024-08-30T10:48:25Z" level=error msg="could not sync roles: error executing sync statements: could not execute sync requests for users: could not create user \"app-new_reader\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_reader\" parameters: pq: role \"app-new_reader\" does not exist', 'could not create user \"app-new_reader_user\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_reader_user\" parameters: pq: role \"app-new_reader_user\" does not exist', 'could not create user \"app-new_public_owner\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_public_owner\" parameters: pq: role \"app-new_public_owner\" does not exist', 'could not create user \"app-new_public_reader\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_public_reader\" parameters: pq: role \"app-new_public_reader\" does not exist', 'could not create user \"app-new_public_writer\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_public_writer\" parameters: pq: role \"app-new_public_writer\" does not exist', 'could not create user \"app-new_writer_user\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_writer_user\" parameters: pq: role \"app-new_writer_user\" does not exist', 'could not create user \"app-new_writer\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_writer\" parameters: pq: role \"app-new_writer\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0

Roles , Users and DBs:

root@pg-demo-0:/home/postgres# psql -h localhost -U postgres
Password for user postgres:
psql (16.2 (Ubuntu 16.2-1.pgdg22.04+1), server 14.11 (Ubuntu 14.11-1.pgdg22.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type "help" for help.

postgres=# select * from pg_roles;
          rolname          | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolconnlimit | rolpassword | rolvaliduntil | rolbypassrls |             rolconfig             |  oid
---------------------------+----------+------------+---------------+-------------+-------------+----------------+--------------+-------------+---------------+--------------+-----------------------------------+-------
 pg_database_owner         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  6171
 pg_read_all_data          | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  6181
 pg_write_all_data         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  6182
 pg_monitor                | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  3373
 pg_read_all_settings      | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  3374
 pg_read_all_stats         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  3375
 pg_stat_scan_tables       | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  3377
 pg_read_server_files      | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  4569
 pg_write_server_files     | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  4570
 pg_execute_server_program | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  4571
 pg_signal_backend         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   |  4200
 postgres                  | t        | t          | t             | t           | t           | t              |           -1 | ********    |               | t            |                                   |    10
 admin                     | f        | t          | f             | t           | f           | f              |           -1 | ********    |               | f            |                                   | 16384
 cron_admin                | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   | 16385
 zalandos                  | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   | 16386
 robot_zmon                | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            |                                   | 16387
 standby                   | f        | t          | f             | f           | t           | t              |           -1 | ********    |               | f            |                                   | 16710
 app1_owner_user           | f        | t          | f             | f           | t           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16720
 app1_reader_user          | f        | t          | f             | f           | t           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16727
 app1_writer_user          | f        | t          | f             | f           | t           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16728
 app1_public_writer        | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16730
 app1_writer               | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16726
 app1_public_reader        | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16729
 app-new_owner_user        | f        | t          | f             | f           | t           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16744
 app1_public_owner         | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16725
 app1_owner                | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16719
 app-new_owner             | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16743
 app1_reader               | f        | t          | f             | f           | f           | f              |           -1 | ********    |               | f            | {"search_path=\"$user\", public"} | 16723
(28 rows)

postgres=# \du
                                  List of roles
     Role name      |                         Attributes
--------------------+------------------------------------------------------------
 admin              | Create DB, Cannot login
 app-new_owner      | Cannot login
 app-new_owner_user |
 app1_owner         | Cannot login
 app1_owner_user    |
 app1_public_owner  | Cannot login
 app1_public_reader | Cannot login
 app1_public_writer | Cannot login
 app1_reader        | Cannot login
 app1_reader_user   |
 app1_writer        | Cannot login
 app1_writer_user   |
 cron_admin         | Cannot login
 postgres           | Superuser, Create role, Create DB, Replication, Bypass RLS
 robot_zmon         | Cannot login
 standby            | Replication
 zalandos           | Cannot login

postgres=# \l
                                                        List of databases
   Name    |   Owner    | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges
-----------+------------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------
 app1      | app1_owner | UTF8     | libc            | en_US.utf-8 | en_US.utf-8 |            |           |
 postgres  | postgres   | UTF8     | libc            | en_US.utf-8 | en_US.utf-8 |            |           |
 template0 | postgres   | UTF8     | libc            | en_US.utf-8 | en_US.utf-8 |            |           | =c/postgres          +
           |            |          |                 |             |             |            |           | postgres=CTc/postgres
 template1 | postgres   | UTF8     | libc            | en_US.utf-8 | en_US.utf-8 |            |           | =c/postgres          +
           |            |          |                 |             |             |            |           | postgres=CTc/postgres
(4 rows)

Postgresql cluster:

apiVersion: acid.zalan.do/v1
kind: postgresql
metadata:
  annotations:
    reloader.vmsp.test.com/auto: "true"
    vmsp.test.com/delete-protection: "true"
  creationTimestamp: "2024-08-30T10:40:03Z"
  generation: 3
  name: pg-demo
  namespace: vmsp-platform
  resourceVersion: "7181"
  uid: 7a400689-8f55-4277-8c1e-a93a0bcac027
spec:
  allowedSourceRanges: null
  enableConnectionPooler: false
  enableReplicaConnectionPooler: false
  env:
  - name: ALLOW_NOSSL
    value: "true"
  numberOfInstances: 3
  patroni:
    failsafe_mode: true
    synchronous_mode: true
    synchronous_mode_strict: true
  postgresql:
    parameters:
      max_connections: "500"
      synchronous_commit: "on"
    version: "14"
  preparedDatabases:
    app-new:
      defaultUsers: true
      schemas:
        public: {}
    app1:
      defaultUsers: true
      schemas:
        public: {}
  resources:
    limits:
      cpu: 2000m
      memory: 2Gi
    requests:
      cpu: 500m
      memory: 512Mi
  sidecars:
  - env:
    - name: DATA_SOURCE_URI
      value: localhost:5432/postgres?sslmode=disable
    - name: DATA_SOURCE_USER
      value: $(POSTGRES_USER)
    - name: DATA_SOURCE_PASS
      value: $(POSTGRES_PASSWORD)
    image: 192.168.1.14:5005/images/prometheuscommunity-postgres-exporter:v0.15.0
    name: metrics-exporter
    ports:
    - containerPort: 9187
      name: http-metrics
      protocol: TCP
  teamId: pg-demo
  tls:
    caFile: ca.crt
    secretName: pg-demo-vmsp-platform-postgres-cert-secret
  users:
    postgres:
    - superuser
    - createdb
  volume:
    size: 4Gi
status:
  PostgresClusterStatus: Running

Logs:

time="2024-08-30T10:48:21Z" level=info msg="UPDATE event has been queued" cluster-name=vmsp-platform/pg-demo pkg=controller worker=0
time="2024-08-30T10:48:21Z" level=info msg="update of the cluster started" cluster-name=vmsp-platform/pg-demo pkg=controller worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-    resourceVersion: 3700," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-    generation: 2," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+    resourceVersion: 3932," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+    generation: 3," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        manager: postgres-operator," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        operation: Update," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        apiVersion: acid.zalan.do/v1," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        time: 2024-08-30T10:46:50Z," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        fieldsType: FieldsV1," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        fieldsV1: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+          f:status: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+            .: {}," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+            f:PostgresClusterStatus: {}" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+          }" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        subresource: status" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+      }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+      {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        time: 2024-08-30T10:46:47Z," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        time: 2024-08-30T10:48:21Z," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+              f:app-new: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+                .: {}," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+                f:defaultUsers: {}," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+                f:schemas: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+                  .: {}," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+                  f:public: {}" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+                }" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+              }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-      }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-      {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        manager: postgres-operator," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        operation: Update," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        apiVersion: acid.zalan.do/v1," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        time: 2024-08-30T10:46:50Z," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        fieldsType: FieldsV1," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        fieldsV1: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-          f:status: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-            .: {}," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-            f:PostgresClusterStatus: {}" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-          }" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="-        subresource: status" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+      app-new: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        schemas: {" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+          public: {}" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+        defaultUsers: true" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="+      }," cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=info msg="postgresql major version unchanged or smaller, no changes needed" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="initialize users" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=warning msg="cannot initialize a new manifest robot role with the name of the system user \"postgres\"" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="team API is disabled" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="team API is disabled" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="syncing secrets" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=info msg="syncing secrets" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="created new secret vmsp-platform/app-new-writer-user.pg-demo.credentials.postgresql.acid.zalan.do, namespace: vmsp-platform, uid: d17eaa02-b167-427f-b85a-948e760593cc" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="created new secret vmsp-platform/app-new-owner-user.pg-demo.credentials.postgresql.acid.zalan.do, namespace: vmsp-platform, uid: 69cd74b2-c4e1-425d-ba9f-4eef50571560" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="created new secret vmsp-platform/app-new-reader-user.pg-demo.credentials.postgresql.acid.zalan.do, namespace: vmsp-platform, uid: 2f28af10-c0d4-4c7d-9b69-72464ebfc026" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:21Z" level=debug msg="syncing volumes using \"pvc\" storage resize mode" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:22Z" level=info msg="volume claims do not require changes" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:22Z" level=info msg="Mount additional volumes: [{Name:pg-demo-vmsp-platform-postgres-cert-secret MountPath:/tls SubPath: TargetContainers:[postgres] VolumeSource:{HostPath:nil EmptyDir:nil GCEPersistentDisk:nil AWSElasticBlockStore:nil GitRepo:nil Secret:&SecretVolumeSource{SecretName:pg-demo-vmsp-platform-postgres-cert-secret,Items:[]KeyToPath{},DefaultMode:*416,Optional:nil,} NFS:nil ISCSI:nil Glusterfs:nil PersistentVolumeClaim:nil RBD:nil FlexVolume:nil Cinder:nil CephFS:nil Flocker:nil DownwardAPI:nil FC:nil AzureFile:nil ConfigMap:nil VsphereVolume:nil Quobyte:nil AzureDisk:nil PhotonPersistentDisk:nil Projected:nil PortworxVolume:nil ScaleIO:nil StorageOS:nil CSI:nil Ephemeral:nil}}]" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:22Z" level=info msg="Mount additional volumes: [{Name:pg-demo-vmsp-platform-postgres-cert-secret MountPath:/tls SubPath: TargetContainers:[postgres] VolumeSource:{HostPath:nil EmptyDir:nil GCEPersistentDisk:nil AWSElasticBlockStore:nil GitRepo:nil Secret:&SecretVolumeSource{SecretName:pg-demo-vmsp-platform-postgres-cert-secret,Items:[]KeyToPath{},DefaultMode:*416,Optional:nil,} NFS:nil ISCSI:nil Glusterfs:nil PersistentVolumeClaim:nil RBD:nil FlexVolume:nil Cinder:nil CephFS:nil Flocker:nil DownwardAPI:nil FC:nil AzureFile:nil ConfigMap:nil VsphereVolume:nil Quobyte:nil AzureDisk:nil PhotonPersistentDisk:nil Projected:nil PortworxVolume:nil ScaleIO:nil StorageOS:nil CSI:nil Ephemeral:nil}}]" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:22Z" level=debug msg="syncing roles" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:25Z" level=debug msg="closing database connection" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:25Z" level=error msg="could not sync roles: error executing sync statements: could not execute sync requests for users: could not create user \"app-new_reader\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_reader\" parameters: pq: role \"app-new_reader\" does not exist', 'could not create user \"app-new_reader_user\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_reader_user\" parameters: pq: role \"app-new_reader_user\" does not exist', 'could not create user \"app-new_public_owner\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_public_owner\" parameters: pq: role \"app-new_public_owner\" does not exist', 'could not create user \"app-new_public_reader\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_public_reader\" parameters: pq: role \"app-new_public_reader\" does not exist', 'could not create user \"app-new_public_writer\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_public_writer\" parameters: pq: role \"app-new_public_writer\" does not exist', 'could not create user \"app-new_writer_user\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_writer_user\" parameters: pq: role \"app-new_writer_user\" does not exist', 'could not create user \"app-new_writer\": pq: syntax error at or near \"-\"', 'could not set custom user \"app-new_writer\" parameters: pq: role \"app-new_writer\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:25Z" level=info msg="syncing databases" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:25Z" level=info msg="database \"app-new\" has invalid name" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:25Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:40Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:48:55Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:49:10Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:49:25Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:49:40Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:49:55Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:50:10Z" level=warning msg="could not connect to Postgres database: pq: database \"app-new\" does not exist" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
time="2024-08-30T10:50:10Z" level=debug msg="closing database connection" cluster-name=vmsp-platform/pg-demo pkg=cluster worker=0
FxKu commented 2 months ago

For database names we have a regexp in place which does not allow hivens. Unfortunately, the PR to make it configurable got stuck at some point.

About user creation failing, I think this part (and admin template) of the SQL command does not take special characters into account. Should be easy to fix.

hvp1991 commented 2 months ago

Thanks @FxKu for the response, Just wanted to confirm the PR to make it configurable would also support special chars in database names (i.e hyphen -). Also Can we make sure when we have special character in database name all the following process / operations (user creation, role creation and any other things) would support the same and sql command is compatible as well using double quotes..