Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Make SQL changes that are not backward-compatible
Browse files Browse the repository at this point in the history
- Make the metric name the first key on the label array
- Make the label array it's own type

This makes it easier to exclude the metric name when doing
cross-metric comparison.
  • Loading branch information
cevian committed Apr 18, 2020
1 parent 66e725f commit 4b94c02
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pkg/pgmodel/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func TestSQLJsonLabelArray(t *testing.T) {
}

var jsonres []byte
err = db.QueryRow(context.Background(), "SELECT * FROM prom.label_array_to_jsonb($1)", labelArray).Scan(&jsonres)
err = db.QueryRow(context.Background(), "SELECT * FROM prom.label_array_to_jsonb(($1::int[]))", labelArray).Scan(&jsonres)
if err != nil {
t.Fatal(err)
}
Expand All @@ -594,7 +594,7 @@ func TestSQLJsonLabelArray(t *testing.T) {
retKeys []string
retVals []string
)
err = db.QueryRow(context.Background(), "SELECT * FROM prom.label_array_to_key_value_array($1)", labelArray).Scan(&retKeys, &retVals)
err = db.QueryRow(context.Background(), "SELECT * FROM prom.label_array_to_key_value_array($1::int[])", labelArray).Scan(&retKeys, &retVals)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 4b94c02

Please sign in to comment.