Skip to content

Commit 94e921b

Browse files
committed
Merge branch 'PGPROEE9_6' into PGPROEE9_6_CFS
2 parents 06c0486 + a14efc1 commit 94e921b

File tree

353 files changed

+21897
-2987
lines changed

Some content is hidden

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

353 files changed

+21897
-2987
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ lib*.pc
3838
/Debug/
3939
/Release/
4040
/tmp_install/
41+
42+
# Contrib
43+
/contrib/*/log/
44+
/contrib/*/results/
45+
/contrib/*/tmp_check/
46+
/contrib/pg_query_state/isolation_output/

.gitlab-ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ test:ubuntu-16.04:
1515
only:
1616
- PGPROEE9_6
1717
before_script:
18-
- apt-get update && apt-get install -y sudo gcc make flex bison libreadline-dev zlib1g-dev openjade libzstd0 libzstd-dev opensp
18+
- apt-get update && apt-get install -y sudo gcc make flex bison libreadline-dev zlib1g-dev openjade libzstd0 libzstd-dev opensp docbook docbook-xml docbook-xsl libxml2-utils xsltproc python-dev libicu-dev
1919
script:
20-
- ./configure --prefix=/opt/pgproee
20+
- ./configure --prefix=/opt/pgproee --with-zstd --with-icu --with-python
2121
- make -j $CORES world
22-
- sudo make install-world
23-
- make check
24-
- cd contrib
25-
- make check
22+
- make check-world
2623
when: always

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2754,7 +2754,7 @@ else
27542754
fi
27552755

27562756

2757-
PGPRO_VERSION="$PACKAGE_VERSION.1"
2757+
PGPRO_VERSION="$PACKAGE_VERSION.2"
27582758
PGPRO_PACKAGE_NAME="PostgresPro"
27592759
PGPRO_EDITION="enterprise"
27602760

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major versio
3838
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
3939
[PG_VERSION="$PACKAGE_VERSION$withval"],
4040
[PG_VERSION="$PACKAGE_VERSION"])
41-
PGPRO_VERSION="$PACKAGE_VERSION.1"
41+
PGPRO_VERSION="$PACKAGE_VERSION.2"
4242
PGPRO_PACKAGE_NAME="PostgresPro"
4343
PGPRO_EDITION="enterprise"
4444
AC_SUBST(PGPRO_PACKAGE_NAME)

contrib/Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,15 @@ SUBDIRS = \
6060
pg_variables \
6161
jsquery \
6262
sr_plan \
63-
pg_arman \
63+
pg_probackup \
6464
pg_pathman \
6565
shared_ispell \
66-
pg_hint_plan
66+
vacuumlo \
67+
pg_hint_plan \
68+
fulleq \
69+
fasttrun \
70+
online_analyze \
71+
plantuner
6772

6873
ifeq ($(with_openssl),yes)
6974
SUBDIRS += sslinfo
@@ -101,6 +106,12 @@ else
101106
ALWAYS_SUBDIRS += hstore_plpython ltree_plpython
102107
endif
103108

109+
ifeq ($(with_icu),yes)
110+
SUBDIRS += mchar
111+
else
112+
ALWAYS_SUBDIRS += mchar
113+
endif
114+
104115
# Missing:
105116
# start-scripts \ (does not have a makefile)
106117

contrib/fasttrun/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
MODULE_big = fasttrun
2+
OBJS = fasttrun.o $(WIN32RES)
3+
EXTENSION = fasttrun
4+
DATA = fasttrun--1.0.sql
5+
DOCS = README.fasttrun
6+
REGRESS = fasttrun
7+
PGFIELDDESC = "fasttrun - functions to truncates the temporary table and doesn't grow pg_class size."
8+
9+
ifdef USE_PGXS
10+
PGXS := $(shell pg_config --pgxs)
11+
include $(PGXS)
12+
else
13+
subdir = contrib/fasttrun
14+
top_builddir = ../..
15+
include $(top_builddir)/src/Makefile.global
16+
include $(top_srcdir)/contrib/contrib-global.mk
17+
endif

contrib/fasttrun/README.fasttrun

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
select fasttruncate('TABLE_NAME');
2+
3+
Function truncates the temporary table and doesn't grow
4+
pg_class size.
5+
6+
Warning: function isn't transaction safe!
7+
8+
For tests:
9+
create or replace function f() returns void as $$
10+
begin
11+
for i in 1..1000
12+
loop
13+
PERFORM fasttruncate('tt1');
14+
end loop;
15+
end;
16+
$$ language plpgsql;
17+
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
CREATE EXTENSION fasttrun;
2+
create table persist ( a int );
3+
insert into persist values (1);
4+
select fasttruncate('persist');
5+
ERROR: Relation isn't a temporary table
6+
insert into persist values (2);
7+
select * from persist order by a;
8+
a
9+
---
10+
1
11+
2
12+
(2 rows)
13+
14+
create temp table temp1 (a int);
15+
insert into temp1 values (1);
16+
BEGIN;
17+
create temp table temp2 (a int);
18+
insert into temp2 values (1);
19+
select * from temp1 order by a;
20+
a
21+
---
22+
1
23+
(1 row)
24+
25+
select * from temp2 order by a;
26+
a
27+
---
28+
1
29+
(1 row)
30+
31+
insert into temp1 (select * from generate_series(1,10000));
32+
insert into temp2 (select * from generate_series(1,11000));
33+
analyze temp2;
34+
select relname, relpages>0, reltuples>0 from pg_class where relname in ('temp1', 'temp2') order by relname;
35+
relname | ?column? | ?column?
36+
---------+----------+----------
37+
temp1 | f | f
38+
temp2 | t | t
39+
(2 rows)
40+
41+
select fasttruncate('temp1');
42+
fasttruncate
43+
--------------
44+
45+
(1 row)
46+
47+
select fasttruncate('temp2');
48+
fasttruncate
49+
--------------
50+
51+
(1 row)
52+
53+
insert into temp1 values (-2);
54+
insert into temp2 values (-2);
55+
select * from temp1 order by a;
56+
a
57+
----
58+
-2
59+
(1 row)
60+
61+
select * from temp2 order by a;
62+
a
63+
----
64+
-2
65+
(1 row)
66+
67+
COMMIT;
68+
select * from temp1 order by a;
69+
a
70+
----
71+
-2
72+
(1 row)
73+
74+
select * from temp2 order by a;
75+
a
76+
----
77+
-2
78+
(1 row)
79+
80+
select relname, relpages>0, reltuples>0 from pg_class where relname in ('temp1', 'temp2') order by relname;
81+
relname | ?column? | ?column?
82+
---------+----------+----------
83+
temp1 | f | f
84+
temp2 | f | f
85+
(2 rows)
86+
87+
select fasttruncate('temp1');
88+
fasttruncate
89+
--------------
90+
91+
(1 row)
92+
93+
select fasttruncate('temp2');
94+
fasttruncate
95+
--------------
96+
97+
(1 row)
98+
99+
select * from temp1 order by a;
100+
a
101+
---
102+
(0 rows)
103+
104+
select * from temp2 order by a;
105+
a
106+
---
107+
(0 rows)
108+
109+
select relname, relpages>0, reltuples>0 from pg_class where relname in ('temp1', 'temp2') order by relname;
110+
relname | ?column? | ?column?
111+
---------+----------+----------
112+
temp1 | f | f
113+
temp2 | f | f
114+
(2 rows)
115+

contrib/fasttrun/fasttrun--1.0.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE OR REPLACE FUNCTION fasttruncate(text)
2+
RETURNS void AS 'MODULE_PATHNAME'
3+
LANGUAGE C RETURNS NULL ON NULL INPUT VOLATILE;

contrib/fasttrun/fasttrun.c

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#include "postgres.h"
2+
3+
#include "access/genam.h"
4+
#include "access/heapam.h"
5+
#include "miscadmin.h"
6+
#include "storage/lmgr.h"
7+
#include "storage/bufmgr.h"
8+
#include "catalog/namespace.h"
9+
#include "utils/lsyscache.h"
10+
#include "utils/builtins.h"
11+
#include <fmgr.h>
12+
#include <funcapi.h>
13+
#include <access/heapam.h>
14+
#include <catalog/pg_type.h>
15+
#include <catalog/heap.h>
16+
#include <commands/vacuum.h>
17+
18+
#ifdef PG_MODULE_MAGIC
19+
PG_MODULE_MAGIC;
20+
#endif
21+
22+
PG_FUNCTION_INFO_V1(fasttruncate);
23+
Datum fasttruncate(PG_FUNCTION_ARGS);
24+
Datum
25+
fasttruncate(PG_FUNCTION_ARGS) {
26+
text *name=PG_GETARG_TEXT_P(0);
27+
char *relname;
28+
List *relname_list;
29+
RangeVar *relvar;
30+
Oid relOid;
31+
Relation rel;
32+
bool makeanalyze = false;
33+
34+
relname = palloc( VARSIZE(name) + 1);
35+
memcpy(relname, VARDATA(name), VARSIZE(name)-VARHDRSZ);
36+
relname[ VARSIZE(name)-VARHDRSZ ] = '\0';
37+
38+
relname_list = stringToQualifiedNameList(relname);
39+
relvar = makeRangeVarFromNameList(relname_list);
40+
relOid = RangeVarGetRelid(relvar, AccessExclusiveLock, false);
41+
42+
if ( get_rel_relkind(relOid) != RELKIND_RELATION )
43+
elog(ERROR,"Relation isn't a ordinary table");
44+
45+
rel = heap_open(relOid, NoLock);
46+
47+
if ( !isTempNamespace(get_rel_namespace(relOid)) )
48+
elog(ERROR,"Relation isn't a temporary table");
49+
50+
heap_truncate(list_make1_oid(relOid));
51+
52+
if ( rel->rd_rel->relpages > 0 || rel->rd_rel->reltuples > 0 )
53+
makeanalyze = true;
54+
55+
/*
56+
* heap_truncate doesn't unlock the table,
57+
* so we should unlock it.
58+
*/
59+
60+
heap_close(rel, AccessExclusiveLock);
61+
62+
if ( makeanalyze ) {
63+
VacuumParams params;
64+
65+
params.freeze_min_age = -1;
66+
params.freeze_table_age = -1;
67+
params.multixact_freeze_min_age = -1;
68+
params.multixact_freeze_table_age = -1;
69+
params.is_wraparound = false;
70+
params.log_min_duration = -1;
71+
72+
vacuum(VACOPT_ANALYZE, NULL, relOid, &params, NULL,
73+
GetAccessStrategy(BAS_VACUUM), false);
74+
}
75+
76+
PG_RETURN_VOID();
77+
}

contrib/fasttrun/fasttrun.control

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# fasttrun extension
2+
comment = 'Functions to truncates the temporary table and does not grow pg_class size'
3+
default_version = '1.0'
4+
module_pathname = '$libdir/fasttrun'
5+
relocatable = true

contrib/fasttrun/sql/fasttrun.sql

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
CREATE EXTENSION fasttrun;
2+
3+
create table persist ( a int );
4+
insert into persist values (1);
5+
select fasttruncate('persist');
6+
insert into persist values (2);
7+
select * from persist order by a;
8+
9+
create temp table temp1 (a int);
10+
insert into temp1 values (1);
11+
12+
BEGIN;
13+
14+
create temp table temp2 (a int);
15+
insert into temp2 values (1);
16+
17+
select * from temp1 order by a;
18+
select * from temp2 order by a;
19+
20+
insert into temp1 (select * from generate_series(1,10000));
21+
insert into temp2 (select * from generate_series(1,11000));
22+
23+
analyze temp2;
24+
select relname, relpages>0, reltuples>0 from pg_class where relname in ('temp1', 'temp2') order by relname;
25+
26+
select fasttruncate('temp1');
27+
select fasttruncate('temp2');
28+
29+
insert into temp1 values (-2);
30+
insert into temp2 values (-2);
31+
32+
select * from temp1 order by a;
33+
select * from temp2 order by a;
34+
35+
COMMIT;
36+
37+
select * from temp1 order by a;
38+
select * from temp2 order by a;
39+
40+
select relname, relpages>0, reltuples>0 from pg_class where relname in ('temp1', 'temp2') order by relname;
41+
42+
select fasttruncate('temp1');
43+
select fasttruncate('temp2');
44+
45+
select * from temp1 order by a;
46+
select * from temp2 order by a;
47+
48+
select relname, relpages>0, reltuples>0 from pg_class where relname in ('temp1', 'temp2') order by relname;

contrib/fulleq/Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
MODULE_big = fulleq
2+
OBJS = fulleq.o $(WIN32RES)
3+
EXTENSION = fulleq
4+
DATA = fulleq--1.0.sql
5+
DOCS = README.fulleq
6+
REGRESS = fulleq
7+
PGFIELDDESC = "fulleq - introduce operator == which returns true when operands are equal or both are nulls."
8+
9+
ARGTYPE = bool bytea char name int8 int2 int2vector int4 text \
10+
oid xid cid oidvector float4 float8 abstime reltime macaddr \
11+
inet cidr varchar date time timestamp timestamptz \
12+
interval timetz
13+
14+
#EXTRA_CLEAN = fulleq--1.0.sql
15+
16+
ifdef USE_PGXS
17+
PGXS := $(shell pg_config --pgxs)
18+
include $(PGXS)
19+
else
20+
subdir = contrib/fulleq
21+
top_builddir = ../..
22+
include $(top_builddir)/src/Makefile.global
23+
include $(top_srcdir)/contrib/contrib-global.mk
24+
endif
25+
26+
fulleq--1.0.sql: fulleq--1.0.sql.in.in
27+
echo '\echo Use "CREATE EXTENSION fulleq" to load this file. \quit' > $@
28+
echo 'SET search_path = public;' >> $@
29+
for type in $(ARGTYPE); \
30+
do \
31+
sed -e "s/ARGTYPE/$$type/g" < $< >> $@; \
32+
done
33+

0 commit comments

Comments
 (0)