Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3f323eb

Browse files
committed
pg_freespacemap: Use SQL-standard function bodies
72a5b1f was the piece missing for the conversion of this module. pg_freespace is bumped to 1.3, with its function pg_freespace(regclass) converted to this new style. There are other modules in the tree that need a similar treatment; these will be handled later. Author: Tom Lane Reviewed-by: Ronan Dunklau Discussion: https://postgr.es/m/3395418.1618352794@sss.pgh.pa.us
1 parent db22b90 commit 3f323eb

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

contrib/pg_freespacemap/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ OBJS = \
66
pg_freespacemap.o
77

88
EXTENSION = pg_freespacemap
9-
DATA = pg_freespacemap--1.1.sql pg_freespacemap--1.1--1.2.sql \
9+
DATA = pg_freespacemap--1.1.sql \
10+
pg_freespacemap--1.2--1.3.sql \
11+
pg_freespacemap--1.1--1.2.sql \
1012
pg_freespacemap--1.0--1.1.sql
1113
PGFILEDESC = "pg_freespacemap - monitoring of free space map"
1214

contrib/pg_freespacemap/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ install_data(
2020
'pg_freespacemap--1.0--1.1.sql',
2121
'pg_freespacemap--1.1--1.2.sql',
2222
'pg_freespacemap--1.1.sql',
23+
'pg_freespacemap--1.2--1.3.sql',
2324
'pg_freespacemap.control',
2425
kwargs: contrib_data_args,
2526
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* contrib/pg_freespacemap/pg_freespacemap--1.2--1.3.sql */
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use "ALTER EXTENSION pg_freespacemap UPDATE TO '1.3'" to load this file. \quit
5+
6+
CREATE OR REPLACE FUNCTION
7+
pg_freespace(rel regclass, blkno OUT bigint, avail OUT int2)
8+
RETURNS SETOF RECORD
9+
LANGUAGE SQL PARALLEL SAFE
10+
BEGIN ATOMIC
11+
SELECT blkno, pg_freespace($1, blkno) AS avail
12+
FROM generate_series(0, pg_relation_size($1) / current_setting('block_size')::bigint - 1) AS blkno;
13+
END;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pg_freespacemap extension
22
comment = 'examine the free space map (FSM)'
3-
default_version = '1.2'
3+
default_version = '1.3'
44
module_pathname = '$libdir/pg_freespacemap'
55
relocatable = true

0 commit comments

Comments
 (0)