Skip to content

Commit

Permalink
fix: issue with array connect
Browse files Browse the repository at this point in the history
  • Loading branch information
dosco committed Apr 27, 2021
1 parent 6919574 commit de05470
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/internal/psql/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (c *compilerContext) renderNestedRelColumns(m qcode.Mutate, values bool, pr
}
if values {
if col.Col.Array {
c.w.WriteString(`ARRAY(SELECT `)
c.w.WriteString(`(SELECT `)
c.quoted(col.VCol.Name)
c.w.WriteString(` FROM `)
c.quoted(col.VCol.Table)
Expand Down
6 changes: 4 additions & 2 deletions internal/cmd/cmd_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ func cmdDBMigrate() func(*cobra.Command, []string) {
log.Fatalf("No migrations found")
}

m.OnStart = func(sequence int32, name, direction, sql string) {
log.Infof("Executing migration: %s, %s\n%s", name, direction, sql)
if conf.Debug {
m.OnStart = func(sequence int32, name, direction, sql string) {
log.Infof("Executing migration: %s, %s\n%s", name, direction, sql)
}
}

currentVersion, err := m.GetCurrentVersion()
Expand Down
1 change: 1 addition & 0 deletions serv/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func initPostgres(c *Config, useDB, useTelemetry bool) (*dbConf, error) {
config.Port = c.DB.Port
config.User = c.DB.User
config.Password = c.DB.Password

config.RuntimeParams = map[string]string{
"application_name": c.AppName,
"search_path": c.DB.Schema,
Expand Down
4 changes: 4 additions & 0 deletions serv/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ func (s *Service) reqLog(res *core.Result, err error) {
fields = append(fields, zap.String("sql", res.SQL()))
}

if s.conf.Debug {
s.log.Info(res.SQL())
}

if err != nil {
fields = append(fields, zap.Error(err))
s.zlog.Error("Query Failed", fields...)
Expand Down

0 comments on commit de05470

Please sign in to comment.