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

Commit 68ff25e

Browse files
committed
contrib/pageinspect: Use SQL-standard function bodies.
In the same spirit as 969bbd0, 13e3796, 3f323eb. Tom Lane and Ronan Dunklau Discussion: https://postgr.es/m/3316564.aeNJFYEL58@aivenlaptop
1 parent 667368f commit 68ff25e

File tree

4 files changed

+78
-2
lines changed

4 files changed

+78
-2
lines changed

contrib/pageinspect/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ OBJS = \
1313
rawpage.o
1414

1515
EXTENSION = pageinspect
16-
DATA = pageinspect--1.11--1.12.sql pageinspect--1.10--1.11.sql \
16+
DATA = pageinspect--1.12--1.13.sql \
17+
pageinspect--1.11--1.12.sql pageinspect--1.10--1.11.sql \
1718
pageinspect--1.9--1.10.sql pageinspect--1.8--1.9.sql \
1819
pageinspect--1.7--1.8.sql pageinspect--1.6--1.7.sql \
1920
pageinspect--1.5.sql pageinspect--1.5--1.6.sql \

contrib/pageinspect/meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ install_data(
3737
'pageinspect--1.9--1.10.sql',
3838
'pageinspect--1.10--1.11.sql',
3939
'pageinspect--1.11--1.12.sql',
40+
'pageinspect--1.12--1.13.sql',
4041
'pageinspect.control',
4142
kwargs: contrib_data_args,
4243
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* contrib/pageinspect/pageinspect--1.12--1.13.sql */
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use "ALTER EXTENSION pageinspect UPDATE TO '1.13'" to load this file. \quit
5+
6+
-- Convert SQL functions to new style
7+
8+
CREATE OR REPLACE FUNCTION heap_page_item_attrs(
9+
IN page bytea,
10+
IN rel_oid regclass,
11+
IN do_detoast bool,
12+
OUT lp smallint,
13+
OUT lp_off smallint,
14+
OUT lp_flags smallint,
15+
OUT lp_len smallint,
16+
OUT t_xmin xid,
17+
OUT t_xmax xid,
18+
OUT t_field3 int4,
19+
OUT t_ctid tid,
20+
OUT t_infomask2 integer,
21+
OUT t_infomask integer,
22+
OUT t_hoff smallint,
23+
OUT t_bits text,
24+
OUT t_oid oid,
25+
OUT t_attrs bytea[]
26+
)
27+
RETURNS SETOF record
28+
LANGUAGE SQL PARALLEL RESTRICTED
29+
BEGIN ATOMIC
30+
SELECT lp,
31+
lp_off,
32+
lp_flags,
33+
lp_len,
34+
t_xmin,
35+
t_xmax,
36+
t_field3,
37+
t_ctid,
38+
t_infomask2,
39+
t_infomask,
40+
t_hoff,
41+
t_bits,
42+
t_oid,
43+
tuple_data_split(
44+
rel_oid::oid,
45+
t_data,
46+
t_infomask,
47+
t_infomask2,
48+
t_bits,
49+
do_detoast)
50+
AS t_attrs
51+
FROM heap_page_items(page);
52+
END;
53+
54+
CREATE OR REPLACE FUNCTION heap_page_item_attrs(IN page bytea, IN rel_oid regclass,
55+
OUT lp smallint,
56+
OUT lp_off smallint,
57+
OUT lp_flags smallint,
58+
OUT lp_len smallint,
59+
OUT t_xmin xid,
60+
OUT t_xmax xid,
61+
OUT t_field3 int4,
62+
OUT t_ctid tid,
63+
OUT t_infomask2 integer,
64+
OUT t_infomask integer,
65+
OUT t_hoff smallint,
66+
OUT t_bits text,
67+
OUT t_oid oid,
68+
OUT t_attrs bytea[]
69+
)
70+
RETURNS SETOF record
71+
LANGUAGE SQL PARALLEL RESTRICTED
72+
BEGIN ATOMIC
73+
SELECT * FROM heap_page_item_attrs(page, rel_oid, false);
74+
END;
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pageinspect extension
22
comment = 'inspect the contents of database pages at a low level'
3-
default_version = '1.12'
3+
default_version = '1.13'
44
module_pathname = '$libdir/pageinspect'
55
relocatable = true

0 commit comments

Comments
 (0)