Skip to content

Instantly share code, notes, and snippets.

View grisha's full-sized avatar

Gregory Trubetskoy grisha

View GitHub Profile
-- first we have an array which only has elements 2, 3 and 4 with value of 1
=> select array_fill(1, ARRAY[3], ARRAY[2]);
array_fill
---------------
[2:4]={1,1,1}
(1 row)
-- if we use generate_subscripts() to unnest the array all is well
=> select generate_subscripts(a, 1) as idx, unnest(a) as a from (select array_fill(1, ARRAY[3], ARRAY[2]) as a) x;
@grisha
grisha / simpletgres.go
Created December 22, 2016 14:05
Simple Graphite Server in Golang
// go get github.com/tgres/tgres
// go run simpletgres.go
package main
import (
"fmt"
"math"
"net/http"
"time"