0
votes

Creation of operator classes in postgresql requires the superuser attribute on the role you're using - https://www.postgresql.org/docs/9.6/sql-createopclass.html.

The user who defines an operator class becomes its owner. Presently, the creating user must be a superuser. (This restriction is made because an erroneous operator class definition could confuse or even crash the server.)

However, GCP does not allow you to add the superuser attribute to a role - https://cloud.google.com/sql/docs/postgres/users.

The postgres user is part of the cloudsqlsuperuser role, and has the following attributes (privileges): CREATEROLE, CREATEDB, and LOGIN. It does not have the SUPERUSER or REPLICATION attributes.

Is there any way to create operator classes in GCP postgresql? If so, then how?

1

1 Answers

1
votes

Yes, in a limited way, by using PostgreSQL Extensions for Cloud SQL. Such as btree_gin or btree_gist. Unfortunately, if it is not on this list then it can't be done.

If you need to request a new extension, you can vote for it by finding it on the Issue Tracker (look for Cloud SQL) or creating a new issue.