make CREATE TYPE usage idempotent

PostgresSQL doesn't have a CREATE TYPE OR REPLACE, so we have to work
around this with exception handling.
This commit is contained in:
Florian Dold 2023-06-02 11:46:48 +02:00
parent 04885a289a
commit 2ea3ae1008
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -970,15 +970,16 @@ END $$;
CREATE TYPE exchange_do_array_reserve_insert_return_type
DO $$
BEGIN
CREATE TYPE exchange_do_array_reserve_insert_return_type
AS
(transaction_duplicate BOOLEAN
,ruuid INT8);
EXCEPTION
WHEN duplicate_object THEN null;
END
$$;
CREATE OR REPLACE FUNCTION exchange_do_array_reserves_insert(
IN in_gc_date INT8,