From b96054e7529975a9dd1aba950008c4b449fab6e4 Mon Sep 17 00:00:00 2001 From: reshke Date: Tue, 16 Jan 2024 13:37:42 +0000 Subject: [PATCH] Fix for xproto test --- router/relay/relay.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/router/relay/relay.go b/router/relay/relay.go index 70c64fc64..cb2665f43 100644 --- a/router/relay/relay.go +++ b/router/relay/relay.go @@ -951,11 +951,13 @@ func (rst *RelayStateImpl) DeployPrepStmt(qname string) (shard.PreparedStatement Msg("deploy prepared statement") // TODO: multi-shard statements - routes := rst.CurrentRoutes() - if len(routes) == 1 { - rst.bindRoute = routes[0] - } else { - return shard.PreparedStatementDescriptor{}, fmt.Errorf("failed to deploy prepared statement %s", query) + if rst.bindRoute == nil { + routes := rst.CurrentRoutes() + if len(routes) == 1 { + rst.bindRoute = routes[0] + } else { + return shard.PreparedStatementDescriptor{}, fmt.Errorf("failed to deploy prepared statement %s", query) + } } name := fmt.Sprintf("%d", hash) @@ -1039,11 +1041,9 @@ func (rst *RelayStateImpl) ProcessExtendedBuffer(cmngr poolmgr.PoolMgr) error { unprocessed++ - if rst.bindRoute == nil { - _, err := rst.DeployPrepStmt(q.PreparedStatement) - if err != nil { - return err - } + _, err = rst.DeployPrepStmt(q.PreparedStatement) + if err != nil { + return err } case *pgproto3.Describe: