From e5c67776b7a31daac84b5a047f9e566657e5b7f9 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Sat, 30 Jul 2022 10:35:24 -0700 Subject: [PATCH] fix postgres duration queries to return expected integer type --- src/db/postgres/sql/topic-get-by-id.sql | 6 +++--- src/db/postgres/sql/topic-get-by-url.sql | 6 +++--- src/db/postgres/sql/topic-get-content-by-id.sql | 6 +++--- src/db/postgres/sql/topic-get-info-all.sql | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/db/postgres/sql/topic-get-by-id.sql b/src/db/postgres/sql/topic-get-by-id.sql index 598b675..71d36ed 100644 --- a/src/db/postgres/sql/topic-get-by-id.sql +++ b/src/db/postgres/sql/topic-get-by-id.sql @@ -3,9 +3,9 @@ SELECT id, created, url, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max, + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max, publisher_validation_url, content_hash_algorithm, is_active, diff --git a/src/db/postgres/sql/topic-get-by-url.sql b/src/db/postgres/sql/topic-get-by-url.sql index 13aa67c..877c2a1 100644 --- a/src/db/postgres/sql/topic-get-by-url.sql +++ b/src/db/postgres/sql/topic-get-by-url.sql @@ -3,9 +3,9 @@ SELECT id, created, url, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max, + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max, publisher_validation_url, content_hash_algorithm, is_active, diff --git a/src/db/postgres/sql/topic-get-content-by-id.sql b/src/db/postgres/sql/topic-get-content-by-id.sql index f603991..bafda95 100644 --- a/src/db/postgres/sql/topic-get-content-by-id.sql +++ b/src/db/postgres/sql/topic-get-content-by-id.sql @@ -1,7 +1,7 @@ -- topic including content SELECT *, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max FROM topic WHERE id = $(topicId) diff --git a/src/db/postgres/sql/topic-get-info-all.sql b/src/db/postgres/sql/topic-get-info-all.sql index e428903..4d9aa0d 100644 --- a/src/db/postgres/sql/topic-get-info-all.sql +++ b/src/db/postgres/sql/topic-get-info-all.sql @@ -3,9 +3,9 @@ SELECT t.id, created, url, - extract(epoch FROM lease_seconds_preferred) AS lease_seconds_preferred, - extract(epoch FROM lease_seconds_min) AS lease_seconds_min, - extract(epoch FROM lease_seconds_max) AS lease_seconds_max, + extract(epoch FROM lease_seconds_preferred)::integer AS lease_seconds_preferred, + extract(epoch FROM lease_seconds_min)::integer AS lease_seconds_min, + extract(epoch FROM lease_seconds_max)::integer AS lease_seconds_max, t.publisher_validation_url, t.content_hash_algorithm, t.is_active, -- 2.45.2