diff --git a/pg/pgtest/handler.go b/pg/pgtest/handler.go index 02b1361e2..845aedf19 100644 --- a/pg/pgtest/handler.go +++ b/pg/pgtest/handler.go @@ -33,6 +33,9 @@ func (h HandlerFunc) HandleQuery(ctx context.Context, w pg.QueryResultWriter, q func (h HandlerFunc) HandleSchema(ctx context.Context, portal *pg.Portal) error { return nil } +func (h HandlerFunc) Version() string { + return "testv1" +} var _ pg.QueryHandler = HandlerFunc(nil) diff --git a/pg/protocol.go b/pg/protocol.go index 0fa52a5e9..e58540e1d 100644 --- a/pg/protocol.go +++ b/pg/protocol.go @@ -432,7 +432,8 @@ func (p *Portal) Execute() (shouldTerminate bool, queryReady bool, err error) { return } p.Add(rowDescription) - dataRow, _ := p.Encoder.TextRow("PostgresSQL 13.0 (molecula)") + mesg := fmt.Sprintf("PostgresSQL 13.0 (molecula.%v)", p.server.QueryHandler.Version()) + dataRow, _ := p.Encoder.TextRow(mesg) p.Add(dataRow) case pgSelect1: rowDescription, e := p.Encoder.EncodeColumn("?column?", int32(23), 4) diff --git a/pg/query.go b/pg/query.go index 7aa231670..ebf48e84e 100644 --- a/pg/query.go +++ b/pg/query.go @@ -61,6 +61,7 @@ type QueryHandler interface { // HandleQuery executes a query and writes the results back. HandleQuery(context.Context, QueryResultWriter, Query) error HandleSchema(context.Context, *Portal) error + Version() string } // queryResultWriter implements QueryResultWrtiter over postgres wire protocol. diff --git a/server.go b/server.go index 2e75045d4..93d9947a0 100644 --- a/server.go +++ b/server.go @@ -39,7 +39,6 @@ import ( "github.com/molecula/featurebase/v2/stats" "github.com/molecula/featurebase/v2/storage" "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/vprint" "github.com/pkg/errors" "golang.org/x/sync/errgroup" @@ -1355,7 +1354,6 @@ func (s *Server) PlanSQL(ctx context.Context, q string) (*Stmt, error) { if err != nil { return nil, err } - vprint.VV("PLanning SQL: (%v)", q) return NewPlanner(s.executor).PlanStatement(ctx, st) } diff --git a/server/pg.go b/server/pg.go index 8b7d6478f..533ca0b43 100644 --- a/server/pg.go +++ b/server/pg.go @@ -596,7 +596,16 @@ func (qdh *QueryDecodeHandler) HandleQuery(ctx context.Context, w pg.QueryResult return qdh.Child.HandleQuery(ctx, w, q) } +func (qdh *QueryDecodeHandler) Version() string { + return qdh.Child.Version() +} +func (pqh *PilosaQueryHandler) Version() string { + if pqh.sqlVersion > 0 { + return "v2" + } + return "v1" +} func (pqh *PilosaQueryHandler) HandleSchema(ctx context.Context, portal *pg.Portal) error { schema, err := pqh.Api.Schema(context.Background(), false) if err != nil {