Skip to content

Commit

Permalink
Merge branch 'main' into fix/pg16
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilgdn authored Oct 21, 2024
2 parents e3dc31f + e3b3fe3 commit 70e1aab
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.0.1
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.23.x

- run: go mod vendor

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.53
version: v1.61
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.23'

- name: test
run: make test
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/terraform-providers/terraform-provider-postgresql

go 1.20
go 1.23

toolchain go1.23.2

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1
Expand Down
7 changes: 7 additions & 0 deletions postgresql/resource_postgresql_user_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ func resourcePostgreSQLUserMappingReadImpl(db *DBConnection, d *schema.ResourceD
var userMappingOptions []string
query := "SELECT umoptions FROM information_schema._pg_user_mappings WHERE authorization_identifier = $1 and foreign_server_name = $2"
err = txn.QueryRow(query, username, serverName).Scan(pq.Array(&userMappingOptions))

if err != sql.ErrNoRows && err != nil {
// Fallback to pg_user_mappings table if information_schema._pg_user_mappings is not available
query := "SELECT umoptions FROM pg_user_mappings WHERE usename = $1 and srvname = $2"
err = txn.QueryRow(query, username, serverName).Scan(pq.Array(&userMappingOptions))
}

switch {
case err == sql.ErrNoRows:
log.Printf("[WARN] PostgreSQL user mapping (%s) for server (%s) not found", username, serverName)
Expand Down

0 comments on commit 70e1aab

Please sign in to comment.