GeezerVison is showing github.com — no such column: sharedserver.db_res · Issue #9940 · pgadmin-org/pgadmin4
no such column: sharedserver.db_res #9940DescriptionPlease note that security bugs or issues should be reported to [email protected].
Describe the bug
For unknown reasons (and twice now) my pgadmin instance has started throwing this error when I attempt to connect and open the server dropdown.
To Reproduce
Unknown exact cause. Appeared on fresh install that was otherwise working normally after a few days of sitting running. Persists through container restarts.
Expected behavior
Ability to list and connect to servers with no error produced.
Error message
(sqlite3.OperationalError) no such column: sharedserver.db_res
[SQL: SELECT sharedserver.id AS sharedserver_id, sharedserver.osid AS sharedserver_osid, sharedserver.user_id AS sharedserver_user_id, sharedserver.server_owner AS sharedserver_server_owner, sharedserver.servergroup_id AS sharedserver_servergroup_id, sharedserver.name AS sharedserver_name, sharedserver.host AS sharedserver_host, sharedserver.port AS sharedserver_port, sharedserver.maintenance_db AS sharedserver_maintenance_db, sharedserver.username AS sharedserver_username, sharedserver.password AS sharedserver_password, sharedserver.save_password AS sharedserver_save_password, sharedserver.role AS sharedserver_role, sharedserver.comment AS sharedserver_comment, sharedserver.discovery_id AS sharedserver_discovery_id, sharedserver.db_res AS sharedserver_db_res, sharedserver.bgcolor AS sharedserver_bgcolor, sharedserver.fgcolor AS sharedserver_fgcolor, sharedserver.service AS sharedserver_service, sharedserver.use_ssh_tunnel AS sharedserver_use_ssh_tunnel, sharedserver.tunnel_host AS sharedserver_tunnel_host, sharedserver.tunnel_port AS sharedserver_tunnel_port, sharedserver.tunnel_username AS sharedserver_tunnel_username, sharedserver.tunnel_authentication AS sharedserver_tunnel_authentication, sharedserver.tunnel_identity_file AS sharedserver_tunnel_identity_file, sharedserver.tunnel_prompt_password AS sharedserver_tunnel_prompt_password, sharedserver.tunnel_password AS sharedserver_tunnel_password, sharedserver.tunnel_keep_alive AS sharedserver_tunnel_keep_alive, sharedserver.shared AS sharedserver_shared, sharedserver.connection_params AS sharedserver_connection_params, sharedserver.prepare_threshold AS sharedserver_prepare_threshold, servergroup_1.id AS servergroup_1_id, servergroup_1.user_id AS servergroup_1_user_id, servergroup_1.name AS servergroup_1_name
FROM sharedserver LEFT OUTER JOIN servergroup AS servergroup_1 ON servergroup_1.id = sharedserver.servergroup_id
WHERE sharedserver.name = ? AND sharedserver.user_id = ? AND sharedserver.servergroup_id = ? AND sharedserver.osid = ?
LIMIT ? OFFSET ?]
[parameters: ('Business DBs', 2, 4, 6, 1, 0)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: nixos
- pgAdmin version: 9.13
- Mode: server
- Browser (if running in server mode): firefox
- Package type: docker container
Additional context
It appears that I can still connect to the servers I provided in the file when logged in as the admin, but when I use the sso, it fails to load those. In both cases I get the error message above. I am unsure if there is a similar cause. Activitydeefdragon commented on May 31, 2026 I went through the process of creating a fresh install, and immediately restarting it, and ran into the problem again right away. I suspected it was due to a dual-access to the sqlite database, but I now believe (after more testing) that it has something to do with my startup containers.
I have 2 containers that also execute when my pgadmin container starts up (I am using the runix helm deployment) so that I can set up the database access for my oauth users.
This is the config of those extra containers. After removing those containers, the pgadmin database restarts without issue.
extraInitContainers:
- name: prepare-pgpass
image: busybox:latest
imagePullPolicy: Always
command:
- /bin/sh
- '-c'
- |
cp /tmp/file.pgpass /var/lib/pgadmin/file.pgpass
chown 5050:5050 /var/lib/pgadmin/file.pgpass
chmod 600 /var/lib/pgadmin/file.pgpass
volumeMounts:
- name: pgadmin-data
mountPath: /var/lib/pgadmin
- name: pgpassfile
mountPath: /tmp/file.pgpass
subPath: pgpassfile
securityContext:
runAsUser: 0
- name: import-servers-json
image: docker.io/dpage/pgadmin4:latest
imagePullPolicy: Always
command:
- /bin/sh
- '-c'
- |
/venv/bin/python /pgadmin4/setup.py load-servers --user <Root Admin Email> --auth-source internal --replace /pgadmin4/servers.json
volumeMounts:
- name: pgadmin-data
mountPath: /var/lib/pgadmin
- name: definitions
mountPath: /pgadmin4/servers.json
subPath: servers.json
securityContext:
runAsUser: 0
asheshv commented on Jun 7, 2026 Hi @deefdragon — your follow-up nailed it. The smoking gun: PR #9835 (April 13 2026) added a migration sharedserver_feature_parity_ that drops db_res from sharedserver. That migration first ships in 9.15 — your :latest init container has it, your 9.13 main container doesn't, hence the mismatch.
Fix — pin the init container to 9.14
- name: import-servers-json
image: docker.io/dpage/pgadmin4:9.14 # ← was :latest
9.14 is schema-identical to 9.13 (no migrations added between the two releases), so it's safe — but it has a month of non-schema fixes 9.13 doesn't. The rule that holds going forward: the init container's tag must never be newer than the main container's when they share a data volume, because pgAdmin's migrations are forward-only with destructive operations.
Recovering the broken DB
Stop the deployment, then on the volume:
sqlite3 /var/lib/pgadmin/pgadmin4.db 'ALTER TABLE sharedserver ADD COLUMN db_res TEXT;'
Re-adds the column empty (the per-user shadow data was never writable through it, so it's structurally fine for 9.13's ORM). Apply the Helm change above, redeploy.
If you'd rather start clean: delete pgadmin4.db, redeploy. Your servers.json import will repopulate the registered servers; you'll lose admin password & UI preferences. deefdragon commented on Jun 7, 2026 Ah, The helm install I was using pinned to 9.13 and I missed that the extra containers were on latest. A mismatch would do it yeah. TY for answering why this happened. Will let me re-enable those init containers.
(And the docs PR looks great to note that exact problem) asheshv commented on Jun 7, 2026 @deefdragon — one more thing surfaced while discussing the fix: even after you pin the init container's tag, your deployment is still at risk during future pgAdmin upgrades if you're using Kubernetes' default RollingUpdate strategy and a shared data volume.
The mechanics:
- K8s starts a new pgAdmin pod (newer version), waits for it to become healthy
- New pod's startup runs
db_upgrade() and applies the new release's migrations to pgadmin4.db on the shared volume — including any destructive ones (column drops, etc.)
- New pod becomes healthy. K8s is still routing traffic to the old pod
- Until K8s terminates the old pod, the old pod's ORM (which knows only the pre-upgrade schema) generates queries that now fail against the migrated DB — same
no such column symptom you already hit, but during the upgrade window
The fix is to set the deployment strategy to Recreate, which terminates the old pod before starting the new one:
spec:
strategy:
type: Recreate # not RollingUpdate
Trade-off: a few seconds of downtime per upgrade, but no broken queries served from an out-of-sync pod.
Could you confirm what strategy your Helm chart is currently using? If it's RollingUpdate, switching to Recreate is the second half of making your deployment safe (the first half being the init-container tag pin we already covered). I've extended the docs PR (#10014) to cover both hazards in the same section — happy to also point you at the relevant Helm chart values key if your chart doesn't expose strategy directly.
For context, the docs PR will land both pieces of guidance together:
- Init container tag must not be newer than the main container's
- Deployment strategy must be
Recreate, not RollingUpdate
Both are forced by pgAdmin's forward-only-with-destructive-migrations model — until pgAdmin adopts a multi-release expand-contract migration pattern, these constraints hold for any shared-data-volume deployment. deefdragon commented on Jun 7, 2026 I did specifically set it to Recreate as one of my debug steps between my first and second posts. asheshv commented on Jun 7, 2026 @deefdragon — perfect, both protections are in place on your side then:
- Init container tag: pin to
9.14 (or whatever matches your main container) — fixes the immediate no such column cause
strategy: Recreate: already done, good — that's the rolling-upgrade hazard taken care of
For maintenance going forward, the rule that holds: any time you bump the main container's image tag, bump every sidecar/init container's tag at the same time. The Recreate strategy keeps the upgrade itself safe; matching tags keep the steady-state running pod consistent.
The docs PR (#10014) will land both pieces of guidance for future operators landing on this. Once you've re-enabled the init containers with the tag pin and confirmed everything is healthy, feel free to close this issue — there's nothing more for pgAdmin to do on your specific case. Thanks again for the clear repro and config dump; it made the diagnosis quick.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|