Skip to content

Instantly share code, notes, and snippets.

@mtgto
Created July 23, 2020 00:24
Show Gist options
  • Save mtgto/00d3c5820effeaebb4968d53d08d5431 to your computer and use it in GitHub Desktop.
Save mtgto/00d3c5820effeaebb4968d53d08d5431 to your computer and use it in GitHub Desktop.
timestamptz
select time || ':00' as time, name, value
from (
values
(timestamptz '2020-07-22 09:00:00 UTC', 'b', 3)
, (timestamptz '2020-07-22 10:00:00 UTC', 'a', 1)
, (timestamptz '2020-07-22 10:00:00 UTC', 'b', 2)
) as t (time, name, value)
;
Display the source blob
Display the rendered blob
Raw
<svg class="main-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="600" height="385" style="" viewBox="0 0 600 385"><rect x="0" y="0" width="600" height="385" style="fill: rgb(255, 255, 255); fill-opacity: 1;"/><defs id="defs-6dca94"><g class="clips"><clipPath id="clip6dca94xyplot" class="plotclip"><rect width="387" height="260"/></clipPath><clipPath class="axesclip" id="clip6dca94x"><rect x="50" y="0" width="387" height="385"/></clipPath><clipPath class="axesclip" id="clip6dca94y"><rect x="0" y="10" width="600" height="260"/></clipPath><clipPath class="axesclip" id="clip6dca94xy"><rect x="50" y="10" width="387" height="260"/></clipPath></g><g class="gradients"/></defs><g class="bglayer"/><g class="layer-below"><g class="imagelayer"/><g class="shapelayer"/></g><g class="cartesianlayer"><g class="subplot xy"><g class="layer-subplot"><g class="shapelayer"/><g class="imagelayer"/></g><g class="gridlayer"><g class="x"><path class="xgrid crisp" transform="translate(146.75,0)" d="M0,10v260" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/><path class="xgrid crisp" transform="translate(243.5,0)" d="M0,10v260" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/><path class="xgrid crisp" transform="translate(340.25,0)" d="M0,10v260" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/></g><g class="y"><path class="ygrid crisp" transform="translate(0,257)" d="M50,0h387" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/><path class="ygrid crisp" transform="translate(0,198.5)" d="M50,0h387" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/><path class="ygrid crisp" transform="translate(0,140)" d="M50,0h387" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/><path class="ygrid crisp" transform="translate(0,81.5)" d="M50,0h387" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/><path class="ygrid crisp" transform="translate(0,23)" d="M50,0h387" style="stroke: rgb(238, 238, 238); stroke-opacity: 1; stroke-width: 1px;"/></g></g><g class="zerolinelayer"/><path class="xlines-below"/><path class="ylines-below"/><g class="overlines-below"/><g class="xaxislayer-below"/><g class="yaxislayer-below"/><g class="overaxes-below"/><g class="plot" transform="translate(50, 10)" clip-path="url('#clip6dca94xyplot')"><g class="scatterlayer mlayer"><g class="trace scatter trace1dd531" style="stroke-miterlimit: 2; opacity: 1;"><g class="fills"/><g class="errorbars"/><g class="lines"/><g class="points"/><g class="text"/></g><g class="trace scatter traceefc08a" style="stroke-miterlimit: 2; opacity: 1;"><g class="fills"/><g class="errorbars"/><g class="lines"><path class="js-line" d="M0,13L387,130" style="vector-effect: non-scaling-stroke; fill: none; stroke: rgb(255, 127, 14); stroke-opacity: 1; stroke-width: 2px; opacity: 1;"/></g><g class="points"/><g class="text"/></g></g></g><g class="overplot"/><path class="xlines-above crisp" d="M0,0" style="fill: none;"/><path class="ylines-above crisp" d="M0,0" style="fill: none;"/><g class="overlines-above"/><g class="xaxislayer-above"><g class="xtick"><text text-anchor="start" x="0" y="287" transform="translate(50,0) rotate(30,0,281)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2020-07-22 18:00:00+0000</text></g><g class="xtick"><text text-anchor="start" x="0" y="287" transform="translate(146.75,0) rotate(30,0,281)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2020-07-22 18:15:00+0000</text></g><g class="xtick"><text text-anchor="start" x="0" y="287" transform="translate(243.5,0) rotate(30,0,281)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2020-07-22 18:30:00+0000</text></g><g class="xtick"><text text-anchor="start" x="0" y="287" transform="translate(340.25,0) rotate(30,0,281)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2020-07-22 18:45:00+0000</text></g><g class="xtick"><text text-anchor="start" x="0" y="287" transform="translate(437,0) rotate(30,0,281)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2020-07-22 19:00:00+0000</text></g></g><g class="yaxislayer-above"><g class="ytick"><text text-anchor="end" x="45" y="4.199999999999999" transform="translate(0,257)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">1</text></g><g class="ytick"><text text-anchor="end" x="45" y="4.199999999999999" transform="translate(0,198.5)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">1.5</text></g><g class="ytick"><text text-anchor="end" x="45" y="4.199999999999999" transform="translate(0,140)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2</text></g><g class="ytick"><text text-anchor="end" x="45" y="4.199999999999999" transform="translate(0,81.5)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">2.5</text></g><g class="ytick"><text text-anchor="end" x="45" y="4.199999999999999" transform="translate(0,23)" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">3</text></g></g><g class="overaxes-above"/></g></g><g class="polarlayer"/><g class="ternarylayer"/><g class="geolayer"/><g class="funnelarealayer"/><g class="pielayer"/><g class="treemaplayer"/><g class="sunburstlayer"/><g class="glimages"/><defs id="topdefs-6dca94"><g class="clips"/><clipPath id="legend6dca94"><rect width="100" height="48" x="0" y="0"/></clipPath></defs><g class="layer-above"><g class="imagelayer"/><g class="shapelayer"/></g><g class="infolayer"><g class="legend" pointer-events="all" transform="translate(444.74, 10)"><rect class="bg" shape-rendering="crispEdges" width="100" height="48" x="0" y="0" style="stroke: rgb(68, 68, 68); stroke-opacity: 1; fill: rgb(255, 255, 255); fill-opacity: 1; stroke-width: 0px;"/><g class="scrollbox" transform="translate(0, 0)" clip-path="url('#legend6dca94')"><g class="groups"><g class="traces" transform="translate(0, 14.5)" style="opacity: 1;"><text class="legendtext user-select-none" text-anchor="start" x="40" y="4.680000000000001" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">value (a)</text><g class="layers" style="opacity: 1;"><g class="legendfill"/><g class="legendlines"><path class="js-line" d="M5,0h30" style="fill: none; stroke: rgb(31, 119, 180); stroke-opacity: 1; stroke-width: 2px;"/></g><g class="legendsymbols"><g class="legendpoints"/></g></g><rect class="legendtoggle" pointer-events="all" x="0" y="-9.5" width="94.9375" height="19" style="cursor: pointer; fill: rgb(0, 0, 0); fill-opacity: 0;"/></g><g class="traces" transform="translate(0, 33.5)" style="opacity: 1;"><text class="legendtext user-select-none" text-anchor="start" x="40" y="4.680000000000001" style="font-family: 'Open Sans', verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; white-space: pre;">value (b)</text><g class="layers" style="opacity: 1;"><g class="legendfill"/><g class="legendlines"><path class="js-line" d="M5,0h30" style="fill: none; stroke: rgb(255, 127, 14); stroke-opacity: 1; stroke-width: 2px;"/></g><g class="legendsymbols"><g class="legendpoints"/></g></g><rect class="legendtoggle" pointer-events="all" x="0" y="-9.5" width="94.9375" height="19" style="cursor: pointer; fill: rgb(0, 0, 0); fill-opacity: 0;"/></g></g></g><rect class="scrollbar" rx="20" ry="3" width="0" height="0" x="0" y="0" style="fill: rgb(128, 139, 164); fill-opacity: 1;"/></g><g class="g-gtitle"/><g class="g-xtitle"/><g class="g-ytitle"/></g></svg>
time name value
2020-07-22 18:00:00+09:00 b 3
2020-07-22 19:00:00+09:00 a 1
2020-07-22 19:00:00+09:00 b 2

Data source

key value
type postgres
host localhost
port 5432
user user
database postgres

Created by

Bdash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment