Skip to content

Commit a6ee807

Browse files
committed
merge with master
2 parents f32c856 + 73e7e49 commit a6ee807

File tree

223 files changed

+13037
-5505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+13037
-5505
lines changed

contrib/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ SUBDIRS = \
4040
pglogical \
4141
pgrowlocks \
4242
pgstattuple \
43+
pg_visibility \
4344
postgres_fdw \
4445
seg \
4546
spi \

contrib/ltree/_ltree_gist.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
8585
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
8686
errmsg("array must not contain nulls")));
8787

88-
key = (ltree_gist *) palloc(len);
88+
key = (ltree_gist *) palloc0(len);
8989
SET_VARSIZE(key, len);
9090
key->flag = 0;
9191

@@ -116,7 +116,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
116116
PG_RETURN_POINTER(retval);
117117
}
118118
len = LTG_HDRSIZE;
119-
key = (ltree_gist *) palloc(len);
119+
key = (ltree_gist *) palloc0(len);
120120
SET_VARSIZE(key, len);
121121
key->flag = LTG_ALLTRUE;
122122

@@ -196,7 +196,7 @@ _ltree_union(PG_FUNCTION_ARGS)
196196
}
197197

198198
len = LTG_HDRSIZE + ((flag & LTG_ALLTRUE) ? 0 : ASIGLEN);
199-
result = (ltree_gist *) palloc(len);
199+
result = (ltree_gist *) palloc0(len);
200200
SET_VARSIZE(result, len);
201201
result->flag = flag;
202202
if (!LTG_ISALLTRUE(result))
@@ -333,26 +333,26 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
333333
/* form initial .. */
334334
if (LTG_ISALLTRUE(GETENTRY(entryvec, seed_1)))
335335
{
336-
datum_l = (ltree_gist *) palloc(LTG_HDRSIZE);
336+
datum_l = (ltree_gist *) palloc0(LTG_HDRSIZE);
337337
SET_VARSIZE(datum_l, LTG_HDRSIZE);
338338
datum_l->flag = LTG_ALLTRUE;
339339
}
340340
else
341341
{
342-
datum_l = (ltree_gist *) palloc(LTG_HDRSIZE + ASIGLEN);
342+
datum_l = (ltree_gist *) palloc0(LTG_HDRSIZE + ASIGLEN);
343343
SET_VARSIZE(datum_l, LTG_HDRSIZE + ASIGLEN);
344344
datum_l->flag = 0;
345345
memcpy((void *) LTG_SIGN(datum_l), (void *) LTG_SIGN(GETENTRY(entryvec, seed_1)), sizeof(ABITVEC));
346346
}
347347
if (LTG_ISALLTRUE(GETENTRY(entryvec, seed_2)))
348348
{
349-
datum_r = (ltree_gist *) palloc(LTG_HDRSIZE);
349+
datum_r = (ltree_gist *) palloc0(LTG_HDRSIZE);
350350
SET_VARSIZE(datum_r, LTG_HDRSIZE);
351351
datum_r->flag = LTG_ALLTRUE;
352352
}
353353
else
354354
{
355-
datum_r = (ltree_gist *) palloc(LTG_HDRSIZE + ASIGLEN);
355+
datum_r = (ltree_gist *) palloc0(LTG_HDRSIZE + ASIGLEN);
356356
SET_VARSIZE(datum_r, LTG_HDRSIZE + ASIGLEN);
357357
datum_r->flag = 0;
358358
memcpy((void *) LTG_SIGN(datum_r), (void *) LTG_SIGN(GETENTRY(entryvec, seed_2)), sizeof(ABITVEC));

contrib/ltree/_ltree_op.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ _ltree_extract_isparent(PG_FUNCTION_ARGS)
211211
PG_RETURN_NULL();
212212
}
213213

214-
item = (ltree *) palloc(VARSIZE(found));
214+
item = (ltree *) palloc0(VARSIZE(found));
215215
memcpy(item, found, VARSIZE(found));
216216

217217
PG_FREE_IF_COPY(la, 0);
@@ -234,7 +234,7 @@ _ltree_extract_risparent(PG_FUNCTION_ARGS)
234234
PG_RETURN_NULL();
235235
}
236236

237-
item = (ltree *) palloc(VARSIZE(found));
237+
item = (ltree *) palloc0(VARSIZE(found));
238238
memcpy(item, found, VARSIZE(found));
239239

240240
PG_FREE_IF_COPY(la, 0);
@@ -257,7 +257,7 @@ _ltq_extract_regex(PG_FUNCTION_ARGS)
257257
PG_RETURN_NULL();
258258
}
259259

260-
item = (ltree *) palloc(VARSIZE(found));
260+
item = (ltree *) palloc0(VARSIZE(found));
261261
memcpy(item, found, VARSIZE(found));
262262

263263
PG_FREE_IF_COPY(la, 0);
@@ -280,7 +280,7 @@ _ltxtq_extract_exec(PG_FUNCTION_ARGS)
280280
PG_RETURN_NULL();
281281
}
282282

283-
item = (ltree *) palloc(VARSIZE(found));
283+
item = (ltree *) palloc0(VARSIZE(found));
284284
memcpy(item, found, VARSIZE(found));
285285

286286
PG_FREE_IF_COPY(la, 0);

contrib/ltree/ltree_gist.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ltree_compress(PG_FUNCTION_ARGS)
5656
ltree *val = (ltree *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
5757
int32 len = LTG_HDRSIZE + VARSIZE(val);
5858

59-
key = (ltree_gist *) palloc(len);
59+
key = (ltree_gist *) palloc0(len);
6060
SET_VARSIZE(key, len);
6161
key->flag = LTG_ONENODE;
6262
memcpy((void *) LTG_NODE(key), (void *) val, VARSIZE(val));
@@ -213,7 +213,7 @@ ltree_union(PG_FUNCTION_ARGS)
213213
isleqr = (left == right || ISEQ(left, right)) ? true : false;
214214
*size = LTG_HDRSIZE + ((isalltrue) ? 0 : SIGLEN) + VARSIZE(left) + ((isleqr) ? 0 : VARSIZE(right));
215215

216-
result = (ltree_gist *) palloc(*size);
216+
result = (ltree_gist *) palloc0(*size);
217217
SET_VARSIZE(result, *size);
218218
result->flag = 0;
219219

@@ -386,7 +386,7 @@ ltree_picksplit(PG_FUNCTION_ARGS)
386386
lu_l = LTG_GETLNODE(GETENTRY(entryvec, array[FirstOffsetNumber].index));
387387
isleqr = (lu_l == lu_r || ISEQ(lu_l, lu_r)) ? true : false;
388388
size = LTG_HDRSIZE + ((lisat) ? 0 : SIGLEN) + VARSIZE(lu_l) + ((isleqr) ? 0 : VARSIZE(lu_r));
389-
lu = (ltree_gist *) palloc(size);
389+
lu = (ltree_gist *) palloc0(size);
390390
SET_VARSIZE(lu, size);
391391
lu->flag = 0;
392392
if (lisat)
@@ -403,7 +403,7 @@ ltree_picksplit(PG_FUNCTION_ARGS)
403403
ru_l = LTG_GETLNODE(GETENTRY(entryvec, array[1 + ((maxoff - FirstOffsetNumber + 1) / 2)].index));
404404
isleqr = (ru_l == ru_r || ISEQ(ru_l, ru_r)) ? true : false;
405405
size = LTG_HDRSIZE + ((risat) ? 0 : SIGLEN) + VARSIZE(ru_l) + ((isleqr) ? 0 : VARSIZE(ru_r));
406-
ru = (ltree_gist *) palloc(size);
406+
ru = (ltree_gist *) palloc0(size);
407407
SET_VARSIZE(ru, size);
408408
ru->flag = 0;
409409
if (risat)
@@ -445,7 +445,7 @@ gist_isparent(ltree_gist *key, ltree *query)
445445
static ltree *
446446
copy_ltree(ltree *src)
447447
{
448-
ltree *dst = (ltree *) palloc(VARSIZE(src));
448+
ltree *dst = (ltree *) palloc0(VARSIZE(src));
449449

450450
memcpy(dst, src, VARSIZE(src));
451451
return dst;

contrib/ltree/ltree_op.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ inner_subltree(ltree *t, int32 startpos, int32 endpos)
211211
ptr = LEVEL_NEXT(ptr);
212212
}
213213

214-
res = (ltree *) palloc(LTREE_HDRSIZE + (end - start));
214+
res = (ltree *) palloc0(LTREE_HDRSIZE + (end - start));
215215
SET_VARSIZE(res, LTREE_HDRSIZE + (end - start));
216216
res->numlevel = endpos - startpos;
217217

@@ -268,7 +268,7 @@ ltree_concat(ltree *a, ltree *b)
268268
{
269269
ltree *r;
270270

271-
r = (ltree *) palloc(VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE);
271+
r = (ltree *) palloc0(VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE);
272272
SET_VARSIZE(r, VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE);
273273
r->numlevel = a->numlevel + b->numlevel;
274274

@@ -450,7 +450,7 @@ lca_inner(ltree **a, int len)
450450
l1 = LEVEL_NEXT(l1);
451451
}
452452

453-
res = (ltree *) palloc(reslen);
453+
res = (ltree *) palloc0(reslen);
454454
SET_VARSIZE(res, reslen);
455455
res->numlevel = num;
456456

contrib/ltree/ltxtquery_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ queryin(char *buf)
350350
errmsg("ltxtquery is too large")));
351351
commonlen = COMPUTESIZE(state.num, state.sumlen);
352352

353-
query = (ltxtquery *) palloc(commonlen);
353+
query = (ltxtquery *) palloc0(commonlen);
354354
SET_VARSIZE(query, commonlen);
355355
query->size = state.num;
356356
ptr = GETQUERY(query);

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,7 @@ pgss_shmem_shutdown(int code, Datum arg)
741741
/*
742742
* Rename file into place, so we atomically replace any old one.
743743
*/
744-
if (rename(PGSS_DUMP_FILE ".tmp", PGSS_DUMP_FILE) != 0)
745-
ereport(LOG,
746-
(errcode_for_file_access(),
747-
errmsg("could not rename pg_stat_statement file \"%s\": %m",
748-
PGSS_DUMP_FILE ".tmp")));
744+
(void) durable_rename(PGSS_DUMP_FILE ".tmp", PGSS_DUMP_FILE, LOG);
749745

750746
/* Unlink query-texts file; it's not needed while shutdown */
751747
unlink(PGSS_TEXT_FILE);

contrib/pg_visibility/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# contrib/pg_visibility/Makefile
2+
3+
MODULE_big = pg_visibility
4+
OBJS = pg_visibility.o $(WIN32RES)
5+
6+
EXTENSION = pg_visibility
7+
DATA = pg_visibility--1.0.sql
8+
PGFILEDESC = "pg_visibility - page visibility information"
9+
10+
ifdef USE_PGXS
11+
PG_CONFIG = pg_config
12+
PGXS := $(shell $(PG_CONFIG) --pgxs)
13+
include $(PGXS)
14+
else
15+
subdir = contrib/pg_visibility
16+
top_builddir = ../..
17+
include $(top_builddir)/src/Makefile.global
18+
include $(top_srcdir)/contrib/contrib-global.mk
19+
endif
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* contrib/pg_visibility/pg_visibility--1.0.sql */
2+
3+
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
4+
\echo Use "CREATE EXTENSION pg_visibility" to load this file. \quit
5+
6+
-- Show visibility map information.
7+
CREATE FUNCTION pg_visibility_map(regclass, blkno bigint,
8+
all_visible OUT boolean,
9+
all_frozen OUT boolean)
10+
RETURNS record
11+
AS 'MODULE_PATHNAME', 'pg_visibility_map'
12+
LANGUAGE C STRICT;
13+
14+
-- Show visibility map and page-level visibility information.
15+
CREATE FUNCTION pg_visibility(regclass, blkno bigint,
16+
all_visible OUT boolean,
17+
all_frozen OUT boolean,
18+
pd_all_visible OUT boolean)
19+
RETURNS record
20+
AS 'MODULE_PATHNAME', 'pg_visibility'
21+
LANGUAGE C STRICT;
22+
23+
-- Show visibility map information for each block in a relation.
24+
CREATE FUNCTION pg_visibility_map(regclass, blkno OUT bigint,
25+
all_visible OUT boolean,
26+
all_frozen OUT boolean)
27+
RETURNS SETOF record
28+
AS 'MODULE_PATHNAME', 'pg_visibility_map_rel'
29+
LANGUAGE C STRICT;
30+
31+
-- Show visibility map and page-level visibility information for each block.
32+
CREATE FUNCTION pg_visibility(regclass, blkno OUT bigint,
33+
all_visible OUT boolean,
34+
all_frozen OUT boolean,
35+
pd_all_visible OUT boolean)
36+
RETURNS SETOF record
37+
AS 'MODULE_PATHNAME', 'pg_visibility_rel'
38+
LANGUAGE C STRICT;
39+
40+
-- Show summary of visibility map bits for a relation.
41+
CREATE FUNCTION pg_visibility_map_summary(regclass,
42+
OUT all_visible bigint, OUT all_frozen bigint)
43+
RETURNS record
44+
AS 'MODULE_PATHNAME', 'pg_visibility_map_summary'
45+
LANGUAGE C STRICT;
46+
47+
-- Don't want these to be available to public.
48+
REVOKE ALL ON FUNCTION pg_visibility_map(regclass, bigint) FROM PUBLIC;
49+
REVOKE ALL ON FUNCTION pg_visibility(regclass, bigint) FROM PUBLIC;
50+
REVOKE ALL ON FUNCTION pg_visibility_map(regclass) FROM PUBLIC;
51+
REVOKE ALL ON FUNCTION pg_visibility(regclass) FROM PUBLIC;
52+
REVOKE ALL ON FUNCTION pg_visibility_map_summary(regclass) FROM PUBLIC;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy