Skip to content

Commit

Permalink
Use a proper temporary table when running determine_ca_trust_purposes().
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Stradling committed Oct 9, 2017
1 parent fc93ad1 commit 6c0431a
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions determine_ca_trust_purposes.sql
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
\timing

DROP TABLE ca_trust_purpose_temp;

\set ON_ERROR_STOP on

CREATE TABLE ca_trust_purpose_temp ( LIKE ca_trust_purpose INCLUDING INDEXES);
BEGIN WORK;

CREATE TEMPORARY TABLE ca_trust_purpose_temp ( LIKE ca_trust_purpose INCLUDING INDEXES)
ON COMMIT DROP;

CREATE INDEX ctpt_lc
ON ca_trust_purpose_temp (ITERATION_LAST_MODIFIED, TRUST_PURPOSE_ID, CA_ID, TRUST_CONTEXT_ID);

SELECT determine_ca_trust_purposes();

BEGIN WORK;

LOCK ca_trust_purpose;

TRUNCATE ca_trust_purpose;

INSERT INTO ca_trust_purpose
Expand All @@ -23,5 +20,3 @@ INSERT INTO ca_trust_purpose
COMMIT WORK;

CLUSTER ca_trust_purpose USING ctp_pk;

DROP TABLE ca_trust_purpose_temp;

0 comments on commit 6c0431a

Please sign in to comment.