terraform-provider-postgresql icon indicating copy to clipboard operation
terraform-provider-postgresql copied to clipboard

Cannot create postgresql_publication

Open Anton-Shutik opened this issue 2 years ago • 0 comments

Terraform Version

Terraform v1.3.9

Affected Resource(s)

  • postgresql_publication

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;

Anton-Shutik avatar Aug 04 '23 10:08 Anton-Shutik