-
Notifications
You must be signed in to change notification settings - Fork 796
Closed
Description
Describe the bug
When I configure PGAdmin to use PostgreSQL instead of SQLite, it cannot start up.
To Reproduce
Steps to reproduce the behavior:
- Use this compose file:
services:
pgadmin:
image: dpage/pgadmin4:6.21
container_name: pgadmin
depends_on:
pgadmin-postgres:
condition: service_healthy
environment:
PGADMIN_CONFIG_CONFIG_DATABASE_URI: '''postgresql://pgadmin:pgadmin@pgadmin-postgres:5432/pgadmin'''
PGADMIN_DEFAULT_EMAIL: qa@qa.com
PGADMIN_DEFAULT_PASSWORD: qa.qa
restart: unless-stopped
pgadmin-postgres:
container_name: pgadmin-postgres
environment:
PGDATA: /var/lib/postgresql/data/
PGUSER: pgadmin
POSTGRES_DB: pgadmin
POSTGRES_INITDB_ARGS: --data-checksums
POSTGRES_PASSWORD: pgadmin
POSTGRES_PORT: "5432"
POSTGRES_USER: pgadmin
healthcheck:
test:
- CMD-SHELL
- sh -c 'pg_isready -U pgadmin'
timeout: 30s
interval: 10s
retries: 3
start_period: 15s
image: postgres:14.6
restart: unless-stopped
- run
docker-compose up - See the errors
Expected behavior
PGAdmin should successfully create a new schema in the empty database and then start.
Error message
From the database:
2023-03-13 16:02:21.441 UTC [1] LOG: database system is ready to accept connections
2023-03-13 16:02:37.686 UTC [80] ERROR: relation "version" does not exist at character 75
2023-03-13 16:02:37.686 UTC [80] STATEMENT: SELECT version.name AS version_name, version.value AS version_value
FROM version
WHERE version.name = 'ConfigDB'
LIMIT 1
2023-03-13 16:02:38.487 UTC [81] ERROR: syntax error at or near "user" at character 13
2023-03-13 16:02:38.487 UTC [81] STATEMENT: ALTER TABLE user RENAME TO user_old
2023-03-13 16:02:38.494 UTC [81] ERROR: current transaction is aborted, commands ignored until end of transaction block
2023-03-13 16:02:38.494 UTC [81] STATEMENT: SELECT c.relname FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = 'public' AND c.relkind in ('r', 'p')
2023-03-13 16:02:38.499 UTC [80] ERROR: relation "keys" does not exist at character 63
2023-03-13 16:02:38.499 UTC [80] STATEMENT: SELECT keys.name AS keys_name, keys.value AS keys_value
FROM keys
WHERE keys.name = 'CSRF_SESSION_KEY'
LIMIT 1
From PGAdmin:
2023-03-13 16:02:38,495: ERROR pgadmin: (psycopg2.errors.InFailedSqlTransaction) current transaction is aborted, commands ignored until end of transaction block
[SQL: SELECT c.relname FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = %(schema)s AND c.relkind in ('r', 'p')]
[parameters: {'schema': 'public'}]
(Background on this error at: https://sqlalche.me/e/14/2j85)
Traceback (most recent call last):
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
NOTE: Configuring authentication for SERVER mode.
self.dialect.do_execute(
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation "keys" does not exist
LINE 2: FROM keys
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/pgadmin4/run_pgadmin.py", line 4, in <module>
from pgAdmin4 import app
File "/pgadmin4/pgAdmin4.py", line 93, in <module>
app = create_app()
File "/pgadmin4/pgadmin/__init__.py", line 498, in create_app
name='CSRF_SESSION_KEY').first().value
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2824, in first
return self.limit(1)._iter().first()
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
result = self.session.execute(
File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1714, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement
ret = self._execute_context(
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
self._handle_dbapi_exception(
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
util.raise_(
File "/venv/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "keys" does not exist
LINE 2: FROM keys
Desktop:
- OS: Ubuntu 22.04
- Version: 4:6.21
- Mode: Server
- Browser N/A
- Package type: Container