---
title: How to Fix Permission Denied for Schema Public Error in PostgreSQL?
url: https://docs.vultr.com/support/products/storage/databases/postgresql/how-to-fix-permission-denied-for-schema-public-error-in-postgresql
description: Grant USAGE and CREATE on the public schema as vultradmin to clear this PostgreSQL error on Vultr.
publish_date: 2025-09-15T13:58:31.840268Z
last_updated: 2026-10-26T23:32:44.453612Z
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt


A `permission denied for schema public` error occurs when the connected user lacks the required privileges to access or create objects in the public schema. Vultr Managed PostgreSQL clusters enforce schema-level permissions to ensure secure multi-tenant operation.

By default, the public schema exists in every database, but non-admin users may not automatically have `CREATE` or `USAGE` privileges. To resolve this error and grant the necessary access safely, follow these steps:

1. Connect to your database using the admin account (`vultradmin`) automatically created when your cluster was provisioned. This user has full privileges required to manage roles and schema access.

    ```console
    $ psql postgres://vultradmin:<password>@<hostname>:<port>/defaultdb
    ```

1. Check the privileges of the target user on the public schema. For PostgreSQL 14 and later, run the following query:

    ```sql
    defaultdb=> SELECT
        grantee.rolname AS grantee,
        nspname AS schema_name,
        has_schema_privilege(grantee.rolname, nspname, 'USAGE') AS usage,
        has_schema_privilege(grantee.rolname, nspname, 'CREATE') AS create
    FROM pg_roles grantee
    CROSS JOIN pg_namespace n
    WHERE grantee.rolname = '<target_user>'
        AND n.nspname = 'public';
    ```

    The output shows which privileges the user currently has. For example:

    ```sql
    grantee        | schema_name | usage | create 
    ---------------+-------------+-------+--------
    {target_user}  | public      | f     | f
    ```

1. To allow the user to create and access objects in the public schema, grant `USAGE` and `CREATE` privileges:

    ```sql
    defaultdb=> GRANT USAGE, CREATE ON SCHEMA public TO <target_user>;
    ```

1. Re-run the query from **Step 2** to confirm that the privileges are now set correctly. Example output after granting:

    ```sql
    grantee        | schema_name | usage | create
    ---------------+-------------+-------+--------
    {target_user}  | public      | t     | t
    ```

    The `t` values indicate that the test_user now has both `USAGE` and `CREATE` privileges on the public schema.

In this way, schema-level security is maintained while allowing the user to operate in the public schema without permission errors.