Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add resource for subscriptions #244

Merged
merged 9 commits into from
Nov 26, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: test
on:
push:
branches:
- master
- master
pull_request:

jobs:
Expand All @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
pgversion: ["latest", 12, 11, 10, 9]
pgversion: [14, 13, 12, 11, 10, 9]

env:
PGVERSION: ${{ matrix.pgversion }}
Expand Down
8 changes: 7 additions & 1 deletion postgresql/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const (
featurePubTruncate
featurePublication
featurePubWithoutTruncate
featureSubscription
featureFunction
)

Expand Down Expand Up @@ -103,6 +104,10 @@ var (

// publication is Supported
featurePublication: semver.MustParseRange(">=10.0.0"),

// subscription is Supported
featureSubscription: semver.MustParseRange(">=10.0.0"),
cyrilgdn marked this conversation as resolved.
Show resolved Hide resolved

// We do not support CREATE FUNCTION for Postgresql < 8.4
featureFunction: semver.MustParseRange(">=8.4.0"),
}
Expand Down Expand Up @@ -274,7 +279,8 @@ func (c *Client) Connect() (*DBConnection, error) {
db, err = postgres.Open(context.Background(), dsn)
}
if err != nil {
return nil, fmt.Errorf("Error connecting to PostgreSQL server %s (scheme: %s): %w", c.config.Host, c.config.Scheme, err)
errString := strings.Replace(err.Error(), c.config.Password, "XXXX", 2)
return nil, fmt.Errorf("Error connecting to PostgreSQL server %s (scheme: %s): %s", c.config.Host, c.config.Scheme, errString)
}

// We don't want to retain connection
Expand Down
1 change: 1 addition & 0 deletions postgresql/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func Provider() *schema.Provider {
"postgresql_grant_role": resourcePostgreSQLGrantRole(),
"postgresql_replication_slot": resourcePostgreSQLReplicationSlot(),
"postgresql_publication": resourcePostgreSQLPublication(),
"postgresql_subscription": resourcePostgreSQLSubscription(),
"postgresql_physical_replication_slot": resourcePostgreSQLPhysicalReplicationSlot(),
"postgresql_schema": resourcePostgreSQLSchema(),
"postgresql_role": resourcePostgreSQLRole(),
Expand Down
Loading