This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/document-engine/configuration/database-privileges.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Document Engine database privileges | Nutrient

Document Engine connects to PostgreSQL with two kinds of accounts: one that runs database migrations, and one that its nodes use at runtime. They can be the same account. This guide describes the schema Document Engine uses and the privileges each account needs. For the connection and migration options, refer to the database options.

Database and schema

Use a PostgreSQL database dedicated to Document Engine. Document Engine stores its database objects in the public schema. A different schema can’t be configured.

Put public first on the search_path of the migration account, because Document Engine creates its tables in that schema. The account that Document Engine nodes connect as needs public on its search_path too.

Migration account

The account that runs migrations (PG_ADMIN_USER, or PGUSER when it’s not set) needs to:

  • Use and create objects in the public schema.
  • Create temporary tables in the database.
  • Own the existing Document Engine objects, or inherit the privileges of their owner, when it migrates an existing database.
  • Create the PostgreSQL extensions that migrations install, unless they’re already installed (pg_buffercache, pg_freespacemap, pgrowlocks, pg_stat_statements, pgstattuple, pg_visibility, btree_gist, btree_gin, intarray, and uuid-ossp). Migrations skip pg_freespacemap and pg_visibility when the server doesn’t offer them. On self-managed PostgreSQL, the first six require a superuser, and the others require CREATE on the database. Managed database services have their own extension permissions. If the migration account can’t install them, a database administrator must install them in the Document Engine database before migration.
  • Create the database, if it doesn’t exist yet. This requires the CREATEDB attribute and the en_US.UTF-8 locale on the server. Otherwise, create the database yourself with UTF-8 encoding.

To check the schema and temporary table privileges, run this read-only query in the Document Engine database. Replace migrator with the migration account:

SELECT has_schema_privilege('migrator', 'public', 'USAGE')
AND has_schema_privilege('migrator', 'public', 'CREATE') AS can_create_in_public,
has_database_privilege('migrator', current_database(), 'TEMP') AS can_create_temp_tables;

Both columns return true when the privileges are in place.

Runtime account

The intended runtime account is PGUSER. This is usually the same account as PG_OPERATION_USER, which defaults to PGUSER. If PG_ADMIN_USER and PG_ADMIN_PASSWORD are set on nodes that don’t run migrations, they override PGUSER and PGPASSWORD. The node then connects with the migration account’s credentials. The runtime account needs:

  • CONNECT on the database and USAGE on public.
  • SELECT, INSERT, UPDATE, and DELETE on Document Engine’s tables in public.
  • SELECT, USAGE, and UPDATE on Document Engine’s sequences in public.
  • EXECUTE on the functions Document Engine uses, such as uuid_generate_v4(), if you revoked it from PUBLIC.

When you use a dedicated migration job (ENABLE_DATABASE_MIGRATIONS and EXIT_AFTER_DATABASE_MIGRATIONS set to true), schema migrations can complete before runtime privilege configuration fails. Before starting runtime nodes, make sure the runtime account has all the privileges listed above.