Skip to content

Commit a42992a

Browse files
committed
fix 0.4 to 0.5 upgrade script
1 parent 450571a commit a42992a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

sql/pg_net--0.4--0.5.sql

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
alter function net._encode_url_with_params_array ( text, text[]) strict;
2-
alter table net.http_request_queue drop constraint http_request_queue_pkey;
3-
alter table net._http_response drop constraint _http_response_pkey;
2+
3+
alter table net.http_request_queue drop constraint http_request_queue_pkey cascade;
4+
alter table net._http_response drop constraint _http_response_pkey cascade;
5+
46
drop trigger ensure_worker_is_up on net.http_request_queue;
5-
alter function net._check_worker_is_up() rename to check_worker_is_up;
6-
drop index net._http_response_created_idx;
7+
drop function net._check_worker_is_up();
8+
9+
create or replace function net.check_worker_is_up() returns void as $$
10+
begin
11+
if not exists (select pid from pg_stat_activity where backend_type = 'pg_net worker') then
12+
raise exception using
13+
message = 'the pg_net background worker is not up'
14+
, detail = 'the pg_net background worker is down due to an internal error and cannot process requests'
15+
, hint = 'make sure that you didn''t modify any of pg_net internal tables';
16+
end if;
17+
end
18+
$$ language plpgsql;
19+
20+
drop index if exists net._http_response_created_idx;
21+
722
alter table net.http_request_queue set unlogged;
823
alter table net._http_response set unlogged;

0 commit comments

Comments
 (0)