Skip to main content
A role in Neki has scoped access across all shards within a single branch. The Roles dashboard page tracks roles created through the dashboard, API, or PlanetScale CLI. Roles created directly with Postgres CREATE ROLE are not managed on that page. You are responsible for their passwords, permissions, and lifecycle.

Default and user-defined roles

The default postgres role is best reserved for administrative work. All application traffic should connect via user-defined roles with the least permissions that the connection needs. Resetting the default role’s credentials replaces the password, so every application using that role must be updated together. User-defined roles can be rotated independently. The dashboard selects pg_read_all_data and pg_write_all_data by default, which fits a typical read-write application. Remove either permission when the application does not need it. Common role configurations are:

Create a role

1
Open the database, then go to Settings and select Roles.
2
Select the branch and click New role.
3
Enter a name and select the inherited roles that grant the required permissions.Names can contain up to 63 lowercase letters, numbers, dashes, or underscores. A name cannot start or end with a dash or underscore.
4
Create the role and save its password. Wait until the role is ready before connecting with it. PlanetScale does not show the password again after you leave the credentials view.
You can also create a role while connecting. Open the database, click Connect, select the branch, and click Create new role.

Available inherited roles

pg_read_all_data and pg_write_all_data grant data access. They do not grant permission to create or alter tables. Add the postgres inherited role only when the connection needs administrative access. Neki enforces inherited-role dependencies. Selecting neki_viewer also requires pg_read_all_data; selecting neki_operator also requires postgres. Use separate least-privilege application and migration roles when an application does not need DDL or workflow access. The WITH REPLICATION attribute is available only when the role inherits postgres. Enable it only for a client that needs to start logical replication.

Connection credentials

Each managed role has:
  • A display name used in the dashboard.
  • A generated Postgres login name.
  • A password shown only after the role is created or reset.
  • A branch assignment.
The complete connection username includes a branch suffix. Use the username from the Connect page rather than constructing it yourself. Renaming a role changes its display name, not its generated login name. See Connect to Neki for the complete connection string and replica-routing options.

Manage a role

Resetting credentials creates a new password. Update every client that opens new connections with that role. Before deleting a user-defined role that owns tables, schemas, or other objects, reassign those objects to another role. If the role is still referenced by another object, Neki leaves it in place and reports that it cannot be deleted.
From Settings > Roles, open a role to:
  • View its connection strings.
  • Rename its display name.
  • Reset its credentials.
  • Reassign objects it owns.
  • Delete it.
Use Reassign objects, or select Reassign owned objects while deleting the role. Both options transfer ownership to postgres.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.