cyrilgdn / terraform-provider-postgresql

Terraform PostgreSQL provider
https://www.terraform.io/docs/providers/postgresql/
Mozilla Public License 2.0
356 stars 182 forks source link

Cannot create postgresql_publication #330

Open Anton-Shutik opened 11 months ago

Anton-Shutik commented 11 months ago

Terraform Version

Terraform v1.3.9

Affected Resource(s)

Default user (which is used in provider's connection string) does not have permission to create publication. But the owner specified in the publication has. The issue is that it tries to:

# psql -U default_user
CREATE PUBLICATION my_publication FOR ALL TABLES;
ALTER PUBLICATION my_publication SET OWNER TO publication_owner;

But it should look like this:

# psql -U default_user
SET ROLE  publication_owner;
CREATE PUBLICATION my_publication FOR ALL TABLES;
RESET ROLE;