remove last_time_approx

This commit is contained in:
Matvey Arye 2016-11-17 17:23:52 -05:00
parent bfcb25642e
commit 1fdb3d43f9
2 changed files with 1 additions and 7 deletions

View File

@ -105,18 +105,13 @@ BEGIN
),
insert_distinct AS (
INSERT INTO %6$s as distinct_table
SELECT distinct_field.name, value->>distinct_field.name, max(time)
SELECT distinct_field.name, value->>distinct_field.name
FROM distinct_field
CROSS JOIN selected
WHERE value ? distinct_field.name
GROUP BY distinct_field.name, (value->>distinct_field.name)
ON CONFLICT
-- (field, value)
DO NOTHING
--DO UPDATE
-- SET last_time_approx = EXCLUDED.last_time_approx + (1e9::bigint * 60*60*24::bigint)
--WHERE EXCLUDED.last_time_approx > distinct_table.last_time_approx
--DO UPDATE SET last_time_approx = EXCLUDED.last_time_approx
)
INSERT INTO %1$s (time, %7$s) SELECT time, %8$s FROM selected;
$$,

View File

@ -39,7 +39,6 @@ BEGIN
CREATE TABLE IF NOT EXISTS %1$I.%2$I (
field TEXT,
value TEXT,
last_time_approx BIGINT,
PRIMARY KEY(field, value)
);
$$, schema_name, table_name);