Skip to content

Commit 83704de

Browse files
committed
Merge branch 'v1.11.x' into develop
2 parents 60fc88d + a6c8b83 commit 83704de

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.11.8 [2024-09-05]
2+
_Bug fixes_
3+
* Fix issue where credentials from import foreign schema were lost after restarting session. ([#504](https://github.com/turbot/steampipe-postgres-fdw/issues/504))
4+
15
## v1.11.7 [2024-08-30]
26
_Whats new_
37
* Update steampipe commit reference to include new HCL config to make plugin startup timeout configurable. ([#499](https://github.com/turbot/steampipe-postgres-fdw/issues/499))

fdw.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,21 @@ func goFdwGetRelSize(state *C.FdwPlanState, root *C.PlannerInfo, rows *C.double,
133133

134134
pluginHub := hub.GetHub()
135135

136+
// get connection name
137+
connName := GetSchemaNameFromForeignTableId(types.Oid(state.foreigntableid))
138+
139+
log.Println("[TRACE] connection name:", connName)
140+
141+
// here we are loading the server options(again) so that they are not lost after the session is restarted
142+
serverOpts := GetForeignServerOptionsFromFTableId(types.Oid(state.foreigntableid))
143+
err := pluginHub.ProcessImportForeignSchemaOptions(serverOpts, connName)
144+
if err != nil {
145+
FdwError(sperr.WrapWithMessage(err, "failed to process options"))
146+
}
147+
136148
// reload connection config
137149
// TODO remove need for fdw to load connection config
138-
_, err := pluginHub.LoadConnectionConfig()
150+
_, err = pluginHub.LoadConnectionConfig()
139151
if err != nil {
140152
log.Printf("[ERROR] LoadConnectionConfig failed %v ", err)
141153
FdwError(err)

hub/hub_local.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ func (l *HubLocal) SetConnectionConfig(connectionName, configString string) erro
6868

6969
func (l *HubLocal) UpdateConnectionConfig(connectionName, configString string) error {
7070
log.Printf("[INFO] HubLocal UpdateConnectionConfig: connection: %s, config: %s", connectionName, configString)
71+
72+
// if the connection already exists and the config is the same, do nothing
73+
// this situation could arise when a session is restarted, the server options are loaded again, and
74+
// the connection config is set again which results in the cache getting cleared
75+
if conn, ok := l.connections[connectionName]; ok && conn.Config == configString {
76+
return nil
77+
}
78+
7179
l.connections[connectionName] =
7280
&proto.ConnectionConfig{
7381
Connection: connectionName,

version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// The main version number that is being run at the moment.
14-
var fdwVersion = "1.11.7"
14+
var fdwVersion = "1.11.8"
1515

1616
// A pre-release marker for the version. If this is "" (empty string)
1717
// then it means that it is a final release. Otherwise, this is a pre-release

0 commit comments

Comments
 (0)