Fix prepared statement creation failure when installing a fresh db from a mod folder - ensure the search path has been set before calling EnsureSessionData. Closes #2028

This commit is contained in:
kaidaguerre
2022-05-10 16:40:55 +01:00
committed by GitHub
parent e12d962a7f
commit ceac20e262
2 changed files with 7 additions and 8 deletions

View File

@@ -68,6 +68,13 @@ func (c *DbClient) AcquireSession(ctx context.Context) (sessionResult *db_common
return sessionResult
}
// update required session search path if needed
err = c.ensureSessionSearchPath(ctx, session)
if err != nil {
sessionResult.Error = err
return sessionResult
}
if !session.Initialized {
session.LifeCycle.Add("queued_for_init")
@@ -93,13 +100,6 @@ func (c *DbClient) AcquireSession(ctx context.Context) (sessionResult *db_common
session.Initialized = true
}
// update required session search path if needed
err = c.ensureSessionSearchPath(ctx, session)
if err != nil {
sessionResult.Error = err
return sessionResult
}
// now write back to the map
c.sessionsMutex.Lock()
c.sessions[backendPid] = session

View File

@@ -9,7 +9,6 @@ type SessionDataSource struct {
IntrospectionTableSource func() *modconfig.ModResources
}
// TODO [report] change this to accept a list of queries instead of and create the cut down preparedStatementSource here
// NewSessionDataSource uses the workspace and (optionally) a separate the prepared statemeot source
// and returns a SessionDataSource
// NOTE: preparedStatementSource is only set if specific queries have ben passed to the query command