Introduction
When using Azure Database for PostgreSQL, you might encounter an error during the JFrog Xray database migration process if the environment lacks the necessary permissions for the btree_gist extension. The error message may look like this:
This error indicates that the current PostgreSQL database user (typically azure_pg_admin) does not have the required permissions to create or use the btree_gist extension. This restriction is likely due to security policies in Azure Database for PostgreSQL that limit the use of certain extensions.
In Azure Database for PostgreSQL, some extensions are considered potential security risks and are restricted by default. btree_gist is one of these extensions. If the user lacks the necessary permissions, the migration process will fail.
Resolution
To resolve this issue, you can take the following steps:
2. Asking a superuser (Can be the postgres superuser), create the btree_gist extension using the following command:
When using Azure Database for PostgreSQL, you might encounter an error during the JFrog Xray database migration process if the environment lacks the necessary permissions for the btree_gist extension. The error message may look like this:
Could not start running: Migration for generic has failed: generic migrations output: > 124_xray.up.gom V124_MigrateCurationPackageAuditUniqueActionConstraint ERROR: Method V124_MigrateCurationPackageAuditUniqueActionConstraint returned an error: Failed to create btree_gist extension --- at /go/src/jfrog.com/xray/xray/backend/backend/migration/db/generic-v124-add_unique_action_constraint_to_package_audit.go:46 (GenericDbMigrator.v124WithDB) --- Caused by: ERROR: extension "btree_gist" is not allow-listed for "azure_pg_admin" users in Azure Database for PostgreSQL (SQLSTATE 0A000)
This error indicates that the current PostgreSQL database user (typically azure_pg_admin) does not have the required permissions to create or use the btree_gist extension. This restriction is likely due to security policies in Azure Database for PostgreSQL that limit the use of certain extensions.
In Azure Database for PostgreSQL, some extensions are considered potential security risks and are restricted by default. btree_gist is one of these extensions. If the user lacks the necessary permissions, the migration process will fail.
Resolution
To resolve this issue, you can take the following steps:
1. Contact Azure Support: Request to have the btree_gist extension added to the allow-list so that your database user can install and use the extension.
2. Asking a superuser (Can be the postgres superuser), create the btree_gist extension using the following command:
CREATE EXTENSION IF NOT EXISTS btree_gist;
3. Clear the failed migration from the Xray's database (connect to the Xraydb then run the following query).
\c xraydb delete from db_migrations_running;
4. Restart Xray.