Print a correct database server name when starting

This commit is contained in:
Dan Sosedoff 2018-06-05 18:28:22 -05:00
parent e68c7e2c61
commit 1cbcb73948
2 changed files with 4 additions and 4 deletions

View File

@ -81,7 +81,7 @@ func initClient() {
} }
if !command.Opts.Sessions { if !command.Opts.Sessions {
fmt.Printf("Server runs PostgreSQL v%s\n", cl.ServerVersion()) fmt.Printf("Conneced to %s\n", cl.ServerVersion())
} }
fmt.Println("Checking database objects...") fmt.Println("Checking database objects...")

View File

@ -20,10 +20,10 @@ import (
var ( var (
postgresSignature = regexp.MustCompile(`(?i)postgresql ([\d\.]+)\s`) postgresSignature = regexp.MustCompile(`(?i)postgresql ([\d\.]+)\s`)
postgresType = "postgres" postgresType = "PostgreSQL"
cockroachSignature = regexp.MustCompile(`(?i)cockroachdb ccl v([\d\.]+)\s`) cockroachSignature = regexp.MustCompile(`(?i)cockroachdb ccl v([\d\.]+)\s`)
cockroachType = "cockroach" cockroachType = "CockroachDB"
) )
type Client struct { type Client struct {
@ -297,7 +297,7 @@ func (client *Client) SetReadOnlyMode() error {
} }
func (client *Client) ServerVersion() string { func (client *Client) ServerVersion() string {
return client.serverVersion return fmt.Sprintf("%s %s", client.serverType, client.serverVersion)
} }
func (client *Client) query(query string, args ...interface{}) (*Result, error) { func (client *Client) query(query string, args ...interface{}) (*Result, error) {