SQL-object database roles
Native addons may declare restricted tables and database function entry points. Configure their roles on each node before installing such an addon. These are node settings: the process needs the database identities before it can access database settings. An absent key grants no authority and an addon requiring that binding refuses installation by name.
sql_object_definer_role = 'app_sql_definer'sql_object_maintenance_role = 'app_sql_maintenance'The request binding is the user in database_url_file. The schema owner is the actual user of
owner_database_url_file. Never use a superuser for that connection when installing SQL objects.
The definer is a separate NOLOGIN role; maintenance is a separate login role for declared maintenance
entry points. This configuration names the maintenance identity; it does not supply a connection or
start a maintenance worker. Do not reuse the heartbeat or audit-reader role.
Provision roles using database administration outside addon installation. Every role must be distinct; none may have SUPERUSER, CREATEROLE, REPLICATION or BYPASSRLS. Request and maintenance must not reach each other or either owner through membership. The definer cannot reach the schema owner. To permit function ownership transfer and subsequent upgrades, grant the definer to the schema owner with INHERIT TRUE and SET TRUE. The application validates the effective role graph and refuses unsafe membership, PUBLIC privileges and column grants. Role names contain 1 to 63 UTF-8 bytes without NUL. Names are quoted as identifiers; a supplied invalid value is refused instead of receiving a default.
Install or upgrade the owning addon with the matching native binary and its protected configuration. For example,
run erp module install -d <database> --config <protected-server.toml> valuation. The same option on
module upgrade and module uninstall binds the operation to that database, its candidate addon directory
and its SQL roles. Publish runtime grants using
erp db publish-grants --config <protected-server.toml>. Publication selects the installed addons
without running their hooks or recovering pending operations. It refuses pending lifecycle work;
finish the reviewed addon operation before retrying publication. The publisher leaves restricted
tables, their owned sequences and explicitly exclusive named id sequences out of generic grants.
Partition and inheritance children are excluded as well. A child without its own explicit policy has
no direct role privileges; access goes through its declared parent. Ordinary application tables retain
their normal CRUD grants.
A publication error rolls back its grant transaction. If the preceding addon operation already committed, the command explicitly reports COMMITTED: do not repeat the addon operation merely to retry grants. Correct the reported role/privilege configuration and run publication again. Nodes remain in maintenance until generic and declared privileges pass admission. Missing or changed SQL objects require an addon upgrade, never ad-hoc function replacement or provenance edits.
An exclusive named id sequence keeps the schema owner as its database owner. Installation and grant publication grant only USAGE to the configured definer. When rotating the definer, provision the new NOLOGIN role and configure the schema owner’s membership, then publish and verify before resuming service. An unexpected grant to another role, an additional database default, or a changed sequence identity or ownership prevents admission. Roll back that change or use a reviewed migration. Removing the declaration or its addon also requires explicit reconciliation. Provision the same database roles before a logical restore. PostgreSQL resolves the saved sequence and role identities in the restored catalogue. Publication rechecks the model default, ownership and effective privileges before service.
The publisher declares runtime grant contract 16 with sql_objects=exclusive-id-sequences. Recovery to
an older publisher that could grant broad access is refused before it changes grants or the active
release pointer. Use the matching release’s supported recovery procedure. A rehearsed publication
step does not by itself establish successful activation or deployment.
Enable control admission for stock receipts
Section titled “Enable control admission for stock receipts”Stock Valuation Admission (valuation) is optional and extends stock_account.
Configure the request login and a separate NOLOGIN definer before installing it.
The schema owner must own the affected schema and have SET and INHERIT membership
in the definer so publication can transfer the fixed function. Rehearse the
installation using the release clone gate. The gate provisions a separate clone-only definer, binds its owner
and rehearses the same native lifecycle operation and publication. The request login and the node heartbeat
receive no membership in that role. Ordinary Inventory
Accounting installations do not need this addon for physical stock receipts.
The request login can execute the fixed admission function. The definer receives only the control-table privileges required to initialize a neutral company/product row and hold its lock. The publisher removes existing managed direct access to the control identity sequence. An independently granted former login, including a column-level or identity-sequence grant, blocks publication. The error names the affected role, object and privilege. Trace who needs that grant and review its removal with the database owner. Retry the installation after correcting the grant. A recorded seal, including an expired seal, requires the authorized coordinator or operator to investigate before the receipt can proceed.