Skip to content

Commit fbfd8b9

Browse files
author
Piet Schrijver
committed
Merge branch 'refs/heads/main' into label
2 parents dcd6988 + f46ec22 commit fbfd8b9

File tree

10 files changed

+56
-1475
lines changed

10 files changed

+56
-1475
lines changed

.github/workflows/golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Golangci-Lint
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88
jobs:
99
lint:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Remove waiting-response label
2+
3+
on: [issue_comment]
4+
5+
jobs:
6+
remove_label:
7+
if: github.actor != 'cyrilgdn'
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
steps:
13+
- uses: actions/github-script@v6
14+
with:
15+
script: |
16+
github.rest.issues.removeLabel({
17+
issue_number: context.issue.number,
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
name: ["waiting-response"]
21+
})

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: test
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88

99
jobs:

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
run:
2+
timeout: 5m
3+
14
issues:
25
exclude-rules:
36
- linters:

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ require (
8686
go.uber.org/atomic v1.11.0 // indirect
8787
go.uber.org/multierr v1.11.0 // indirect
8888
go.uber.org/zap v1.24.0 // indirect
89-
golang.org/x/crypto v0.11.0 // indirect
89+
golang.org/x/crypto v0.17.0 // indirect
9090
golang.org/x/mod v0.10.0 // indirect
91-
golang.org/x/sys v0.10.0 // indirect
92-
golang.org/x/text v0.11.0 // indirect
91+
golang.org/x/sys v0.15.0 // indirect
92+
golang.org/x/text v0.14.0 // indirect
9393
golang.org/x/time v0.3.0 // indirect
9494
google.golang.org/api v0.134.0 // indirect
9595
google.golang.org/appengine v1.6.7 // indirect

go.sum

Lines changed: 8 additions & 1443 deletions
Large diffs are not rendered by default.

postgresql/resource_postgresql_default_privileges.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func resourcePostgreSQLDefaultPrivilegesRead(db *DBConnection, d *schema.Resourc
8787
)
8888
}
8989

90-
exists, err := checkRoleDBSchemaExists(db.client, d)
90+
exists, err := checkRoleDBSchemaExists(db, d)
9191
if err != nil {
9292
return err
9393
}

postgresql/resource_postgresql_grant.go

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func resourcePostgreSQLGrantRead(db *DBConnection, d *schema.ResourceData) error
109109
return fmt.Errorf("feature is not supported: %v", err)
110110
}
111111

112-
exists, err := checkRoleDBSchemaExists(db.client, d)
112+
exists, err := checkRoleDBSchemaExists(db, d)
113113
if err != nil {
114114
return err
115115
}
@@ -699,8 +699,19 @@ func revokeRolePrivileges(txn *sql.Tx, d *schema.ResourceData) error {
699699
return nil
700700
}
701701

702-
func checkRoleDBSchemaExists(client *Client, d *schema.ResourceData) (bool, error) {
703-
txn, err := startTransaction(client, "")
702+
func checkRoleDBSchemaExists(db *DBConnection, d *schema.ResourceData) (bool, error) {
703+
// Check the database exists
704+
database := d.Get("database").(string)
705+
exists, err := dbExists(db, database)
706+
if err != nil {
707+
return false, err
708+
}
709+
if !exists {
710+
log.Printf("[DEBUG] database %s does not exists", database)
711+
return false, nil
712+
}
713+
714+
txn, err := startTransaction(db.client, database)
704715
if err != nil {
705716
return false, err
706717
}
@@ -719,29 +730,10 @@ func checkRoleDBSchemaExists(client *Client, d *schema.ResourceData) (bool, erro
719730
}
720731
}
721732

722-
// Check the database exists
723-
database := d.Get("database").(string)
724-
exists, err := dbExists(txn, database)
725-
if err != nil {
726-
return false, err
727-
}
728-
if !exists {
729-
log.Printf("[DEBUG] database %s does not exists", database)
730-
return false, nil
731-
}
732-
733+
// Check the schema exists (the SQL connection needs to be on the right database)
733734
pgSchema := d.Get("schema").(string)
734-
735735
if !sliceContainsStr([]string{"database", "foreign_data_wrapper", "foreign_server"}, d.Get("object_type").(string)) && pgSchema != "" {
736-
// Connect on this database to check if schema exists
737-
dbTxn, err := startTransaction(client, database)
738-
if err != nil {
739-
return false, err
740-
}
741-
defer deferredRollback(dbTxn)
742-
743-
// Check the schema exists (the SQL connection needs to be on the right database)
744-
exists, err = schemaExists(dbTxn, pgSchema)
736+
exists, err = schemaExists(txn, pgSchema)
745737
if err != nil {
746738
return false, err
747739
}

website/docs/index.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ The following arguments are supported:
153153
* `password` - (Optional) Password for the server connection.
154154
* `database_username` - (Optional) Username of the user in the database if different than connection username (See [user name maps](https://www.postgresql.org/docs/current/auth-username-maps.html)).
155155
* `superuser` - (Optional) Should be set to `false` if the user to connect is not a PostgreSQL superuser (as is the case in AWS RDS or GCP SQL).
156-
* In this case, some features might be disabled (e.g.: Refreshing state password from database).
156+
In this case, some features might be disabled (e.g.: Refreshing state password from database).
157157
* `sslmode` - (Optional) Set the priority for an SSL connection to the server.
158158
Valid values for `sslmode` are (note: `prefer` is not supported by Go's
159159
[`lib/pq`][libpq])):

website/docs/r/postgresql_grant_role.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "postgresql_grant_role" "grant_root" {
2727
~> **Note:** If you use `postgresql_grant_role` for a role that you also manage with a `postgresql_role` resource, you need to ignore the changes of the `roles` attribute in the `postgresql_role` resource or they will fight over what your role grants should be. e.g.:
2828
```hcl
2929
resource "postgresql_role" "bob" {
30-
role = "bob"
30+
name = "bob"
3131
3232
lifecycle {
3333
ignore_changes = [

0 commit comments

Comments
 (0)