我有一个包含一些时间序列数据的表。
time | bid | ask
-------------------------------+--------+--------
2018-12-27 01:04:06.978456+00 | 1.7086 |
2018-12-27 01:04:07.006461+00 | 1.7087 |
2018-12-27 01:04:07.021961+00 | | 1.7106
2018-12-27 01:04:08.882591+00 | 1.7025 | 1.7156
2018-12-27 01:04:09.374118+00 | | 1.7106
2018-12-27 01:04:09.39018+00 | 1.7087 | 1.7156
2018-12-27 01:04:15.793528+00 | 1.7045 |
2018-12-27 01:04:15.833545+00 | 1.7083 |
2018-12-27 01:04:15.893536+00 | | 1.7096
2018-12-27 01:04:16.258062+00 | 1.7045 | 1.7095
2018-12-27 01:04:16.653573+00 | 1.7046 | 1.7148
2018-12-27 01:04:16.665564+00 | | 1.7097
我想对 NULL 值进行前向填充,以便我的查询结果如下所示:
time | bid | ask
-------------------------------+--------+--------
2018-12-27 01:04:06.978456+00 | 1.7086 |
2018-12-27 01:04:07.006461+00 | 1.7087 |
2018-12-27 01:04:07.021961+00 | 1.7087 | 1.7106
2018-12-27 01:04:08.882591+00 | 1.7025 | 1.7156
2018-12-27 01:04:09.374118+00 | 1.7025 | 1.7106
2018-12-27 01:04:09.39018+00 | 1.7087 | 1.7156
2018-12-27 01:04:15.793528+00 | 1.7045 | 1.7156
2018-12-27 01:04:15.833545+00 | 1.7083 | 1.7156
2018-12-27 01:04:15.893536+00 | 1.7083 | 1.7096
2018-12-27 01:04:16.258062+00 | 1.7045 | 1.7095
2018-12-27 01:04:16.653573+00 | 1.7046 | 1.7148
2018-12-27 01:04:16.665564+00 | 1.7046 | 1.7097
我怎样才能做到这一点?
我正在使用带有 timescaledb 扩展的 postgresql 10