addsql version to handler

This commit is contained in:
Todd Gruben 2021-09-27 15:42:07 -05:00
parent 214ae4dfac
commit 51876b1821
4 changed files with 12 additions and 3 deletions

View file

@ -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)

View file

@ -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.

View file

@ -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)
}

View file

@ -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 {