I am new to CloudQuery and I am attempting to set up a PostgreSQL source with CDC unsuccessfully. I am getting the error:
failed to sync unmanaged client: failed to alter publication: ERROR: must be owner of publication
I have granted the said user replication role and select permission at the schema level. I further granted him the create right for the said database. I am using Managed Database, Azure Flexible PostgreSQL.
From the error message, it definitely appears as though some permissions are still not quite correct. To help troubleshoot this, I would like to point you to our CDC configuration documentation and, for Azure Flexible Postgres, the Microsoft docs on logical replication and logical decoding.
I’ve not tried with an Azure Postgres instance, but the required privileges seem to be covered by the Microsoft documentation here: Microsoft Documentation
CREATE PUBLICATION publication FOR TABLE account_emailaddress;
ERROR: must be owner of table account_emailaddress
This was the error I got from the CloudQuery side:
failed to sync v3 source dev-postgres: unexpected error from sync client receive: rpc error: code = Unknown desc = failed to sync records: failed to sync unmanaged client: failed to alter publication: ERROR: must be owner of publication testing (SQLSTATE 42501)
In terms of permissions and database configurations, I have done as per the shared Azure documentation.
So my interpretation of the error messages is that in the create publication case (e.g. must be owner of table account_emailaddress), for this to succeed, the user executing the command must also be the owner of the table you are associating a publication with.
In the case of the alter publication (must be owner of publication testing), the CloudQuery user is attempting to alter a publication it doesn’t own. In this case, could the publication have been created manually?
No, I do not have any publications present in my database.
And also on the permissions, I do not wish to grant CloudQuery any privileges apart from read rights for my tables. From what I am seeing, it seems that it wants owner rights.
For CDC to work, CloudQuery needs to be able to create a publication and create replication slots within the publication.
To create a publication, the invoking user must have the CREATE privilege for the current database.
To be able to create a subscription, you must have the privileges of the pg_create_subscription role, as well as CREATE privileges on the current database.