pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

pgAdmin uses ::INTEGER for pg_database.oid, causing NumericValueOutOfRange on large OID values

Open kapalkapiotr opened this issue 3 months ago • 0 comments

When expanding the list of schemas or interacting with a database that has a large OID (e.g. 2496070556), pgAdmin fails with the following error:

(psycopg.errors.NumericValueOutOfRange) integer out of range
[SQL: SELECT database.id AS database_id, database.schema_res AS database_schema_res,
database.server AS database_server
FROM database
WHERE database.id = %(id_1)s::INTEGER AND database.server = %(server_1)s::INTEGER
LIMIT %(param_1)s::INTEGER]
[parameters: {'id_1': 2496070556, 'server_1': 4525, 'param_1': 1}]

Expected behavior: pgAdmin should treat pg_database.oid as BIGINT (or NUMERIC) to support large OIDs without errors.

Steps to reproduce:

  1. Create a new database after the global OID counter exceeds 2,147,483,647.
  2. Open pgAdmin 4 and connect to the server.
  3. Try to expand the database in the browser tree.
  4. pgAdmin throws NumericValueOutOfRange and fails to display schemas.

Example environment: pgAdmin 4 version: 9.6 and 9.8 PostgreSQL version: 15.9 Database OID: 2496070556

Image

kapalkapiotr avatar Oct 07 '25 11:10 kapalkapiotr