Skip to content

Commit 86d14c1

Browse files
authored
Fix pool_size data type in users function (#31)
* fix: fix pgbouncer_server view missing column * chore: update changelog * fix: fix pgbouncer_dns_zones view missing column * fix: change column name reserve_pool to reserve_pool_size for show databases * fix reserve_pool_size datatype in users * fix: fix pool_size data type in users
1 parent 503d11d commit 86d14c1

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
v1.4.0
22
-- Update to support column change in databases from reserve_pool to reserve_pool_size in pgBouncer 1.24
3-
-- Set proper data type for reserve_pool_size in users
3+
-- Set proper data type for pool_size and reserve_pool_size in users
44

55

66
v1.3.0

sql/functions/pgbouncer_fdw_functions.sql

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,8 +1835,8 @@ CREATE FUNCTION @extschema@.pgbouncer_users_func() RETURNS TABLE
18351835
(
18361836
pgbouncer_target_host text
18371837
, name text
1838-
, pool_size int
1839-
, reserve_pool_size int
1838+
, pool_size text
1839+
, reserve_pool_size text
18401840
, pool_mode text
18411841
, max_user_connections int
18421842
, current_connections int
@@ -1878,8 +1878,8 @@ LOOP BEGIN
18781878
FROM dblink(v_row.target_host, 'show users') AS x
18791879
(
18801880
name text
1881-
, pool_size int
1882-
, reserve_pool_size int
1881+
, pool_size text
1882+
, reserve_pool_size text
18831883
, pool_mode text
18841884
, max_user_connections int
18851885
, current_connections int
@@ -1895,12 +1895,12 @@ LOOP BEGIN
18951895
, x.pool_mode
18961896
, x.max_user_connections
18971897
, x.current_connections
1898-
, 0 AS max_user_client_connections
1898+
, 0 AS max_user_client_connections
18991899
, 0 AS current_client_connections
19001900
FROM dblink(v_row.target_host, 'show users') AS x
19011901
(
19021902
name text
1903-
, pool_size int
1903+
, pool_size text
19041904
, pool_mode text
19051905
, max_user_connections int
19061906
, current_connections int
@@ -1909,12 +1909,12 @@ LOOP BEGIN
19091909
RETURN QUERY SELECT
19101910
v_row.target_host AS pgbouncer_target_host
19111911
, x.name
1912-
, 0 AS pool_size
1913-
, 0 AS reserve_pool_size
1912+
, '' AS pool_size
1913+
, '' AS reserve_pool_size
19141914
, x.pool_mode
19151915
, 0 AS max_user_connections
19161916
, 0 AS current_connections
1917-
, 0 AS max_user_client_connections
1917+
, 0 AS max_user_client_connections
19181918
, 0 AS current_client_connections
19191919
FROM dblink(v_row.target_host, 'show users') AS x
19201920
(
@@ -1944,7 +1944,6 @@ $$;
19441944

19451945

19461946

1947-
19481947
/**** ADMIN FUNCTIONS ****/
19491948

19501949
CREATE FUNCTION @extschema@.pgbouncer_command_disable(p_dbname text, p_pgbouncer_target_host text DEFAULT 'pgbouncer') RETURNS void

updates/pgbouncer_fdw--1.3.0--1.4.0.sql

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ AND table_name = 'pgbouncer_users'
3232
AND grantee != 'PUBLIC'
3333
GROUP BY grantee;
3434

35-
3635
DROP VIEW @extschema@.pgbouncer_databases;
3736
DROP VIEW @extschema@.pgbouncer_users;
3837

@@ -243,8 +242,8 @@ CREATE FUNCTION @extschema@.pgbouncer_users_func() RETURNS TABLE
243242
(
244243
pgbouncer_target_host text
245244
, name text
246-
, pool_size int
247-
, reserve_pool_size int
245+
, pool_size text
246+
, reserve_pool_size text
248247
, pool_mode text
249248
, max_user_connections int
250249
, current_connections int
@@ -286,8 +285,8 @@ LOOP BEGIN
286285
FROM dblink(v_row.target_host, 'show users') AS x
287286
(
288287
name text
289-
, pool_size int
290-
, reserve_pool_size int
288+
, pool_size text
289+
, reserve_pool_size text
291290
, pool_mode text
292291
, max_user_connections int
293292
, current_connections int
@@ -299,7 +298,7 @@ LOOP BEGIN
299298
v_row.target_host AS pgbouncer_target_host
300299
, x.name
301300
, x.pool_size
302-
, 0 AS reserve_pool_size
301+
, '' AS reserve_pool_size
303302
, x.pool_mode
304303
, x.max_user_connections
305304
, x.current_connections
@@ -308,7 +307,7 @@ LOOP BEGIN
308307
FROM dblink(v_row.target_host, 'show users') AS x
309308
(
310309
name text
311-
, pool_size int
310+
, pool_size text
312311
, pool_mode text
313312
, max_user_connections int
314313
, current_connections int
@@ -317,8 +316,8 @@ LOOP BEGIN
317316
RETURN QUERY SELECT
318317
v_row.target_host AS pgbouncer_target_host
319318
, x.name
320-
, 0 AS pool_size
321-
, 0 AS reserve_pool_size
319+
, '' AS pool_size
320+
, '' AS reserve_pool_size
322321
, x.pool_mode
323322
, 0 AS max_user_connections
324323
, 0 AS current_connections

0 commit comments

Comments
 (0)