Skip to content

Commit

Permalink
Merge pull request #6 from jfinzel/bugfixes_1_5
Browse files Browse the repository at this point in the history
Bugfixes 1.5.2

* github.com:enova/pg_fact_loader:
  Update changelog
  Remove incorrect cast of timestamptz to a time zone in outer queries
  Add failing tests revealing db-timezone bug
  Fix behavior of SIGTERM to not run the main loop SQL
  • Loading branch information
Jerry Sievers committed Nov 29, 2018
2 parents b13b06e + 6293624 commit 6cd10fe
Show file tree
Hide file tree
Showing 8 changed files with 1,440 additions and 9 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
pg-fact-loader (1.5.2-1) unstable; urgency=medium

* Fix time zone bug and behavior of SIGTERM

-- Jeremy Finzel <[email protected]> Thu, 29 Nov 2018 10:36:36 -0600

pg-fact-loader (1.5.1-2) UNRELEASED; urgency=medium

* Test-Depend on postgresql-contrib-PGVERSION.
Expand Down
7 changes: 5 additions & 2 deletions expected/06_basic_workers.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SET client_min_messages TO warning;
--This is for testing functionality of timezone-specific timestamps
SET TIMEZONE TO 'America/Chicago';
-- Client time zone should not change functionality of worker - use a different one here
SET TIMEZONE TO 'UTC';
--Enable all except dep tables for now
UPDATE fact_loader.fact_tables ft SET enabled = TRUE
WHERE NOT EXISTS (SELECT 1 FROM fact_loader.fact_table_deps d WHERE d.child_id = ft.fact_table_id);
Expand Down Expand Up @@ -117,6 +117,9 @@ ORDER BY customer_id, as_of_date;
5 | [04-12-2018,infinity) | 1 | 04-12-2018
(4 rows)

-- Set time zone back to America/Chicago because the audit data is being logged at that time zone
-- (another great reason NEVER to use timestamp, but functionality we need at any rate)
SET TIMEZONE TO 'America/Chicago';
UPDATE test.customers SET age = 40 WHERE customer_id = 2;
-- We need to make deletes handled with recursive joins as well first before testing this
-- DELETE FROM test.customers WHERE customer_id = 3;
Expand Down
8 changes: 4 additions & 4 deletions functions/sql_builder.sql
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@ example of this, see the test cases involving the test.order_product_promos tabl
END)
AS inner_global_where_sql,
format($$
%s < %s %s
-- changed_at is guaranteed now to be in timestamptz - any time zone casting is only in subquery
changed_at < %s
AND (min_missed_id IS NULL OR (fact_loader_batch_id < min_missed_id))
$$,
quote_ident(c.queue_table_timestamp),
quote_literal(c.maximum_cutoff_time),
changed_at_tz_correction)
quote_literal(c.maximum_cutoff_time)
)
AS outer_global_where_sql,
format($$
AND q.%s = 'I'
Expand Down
Loading

0 comments on commit 6cd10fe

Please sign in to comment.