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

Commit 62e0d10

Browse files
author
Oleg Ivanov
committed
Merge branch 'PGPROEE10' into PGPROEE10_aqo
2 parents 3df46dd + 97a5eec commit 62e0d10

Some content is hidden

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

87 files changed

+5474
-470
lines changed

contrib/in_memory/btree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,9 @@ btree_check_tuple_size(int len, char *relation_name)
958958
if (len > MAX_BTREE_TUPLE_SIZE)
959959
ereport(ERROR,
960960
(errcode(ERRCODE_FDW_ERROR),
961-
errmsg("tuple too large for in_memory table \"%s\"",
961+
errmsg("tuple is too large for in-memory table \"%s\"",
962962
relation_name),
963-
errdetail("Tuple length %d is too large for in memory table (max %d)",
963+
errdetail("Tuple length %d exceeds the maximum allowed %d value.",
964964
len, (int) MAX_BTREE_TUPLE_SIZE)
965965
));
966966
}

contrib/in_memory/debug.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ set_breakpoint(PG_FUNCTION_ARGS)
165165

166166
if (slotno < 1 || slotno > MAX_DEBUG_SLOTS)
167167
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
168-
(errmsg("slot number should be between 1 and %d", MAX_DEBUG_SLOTS))));
168+
(errmsg("slot number must be between 1 and %d", MAX_DEBUG_SLOTS))));
169169

170170
if (eventno < 1 || eventno > MAX_DEBUG_EVENTS)
171171
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
172-
(errmsg("event number should be between 1 and %d", MAX_DEBUG_EVENTS))));
172+
(errmsg("event number must be between 1 and %d", MAX_DEBUG_EVENTS))));
173173

174174
if (skip_count < 0)
175175
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
176-
(errmsg("skip count should be non-negative number"))));
176+
(errmsg("skip count must be a non-negative number"))));
177177

178178
slot = &slots[slotno - 1];
179179

@@ -217,7 +217,7 @@ reset_breakpoint(PG_FUNCTION_ARGS)
217217

218218
if (slotno < 1 || slotno > MAX_DEBUG_SLOTS)
219219
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
220-
(errmsg("slot number should be between 1 and %d", MAX_DEBUG_SLOTS))));
220+
(errmsg("slot number must be between 1 and %d", MAX_DEBUG_SLOTS))));
221221

222222
slot = &slots[slotno - 1];
223223

contrib/in_memory/expected/tuple_limit.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-- Check for tuple length limit
22
TRUNCATE im_test1;
33
INSERT INTO im_test1 VALUES (1, repeat('x', 281));
4-
ERROR: tuple too large for in_memory table "im_test1"
5-
DETAIL: Tuple length 305 is too large for in memory table (max 304)
4+
ERROR: tuple is too large for in-memory table "im_test1"
5+
DETAIL: Tuple length 305 exceeds the maximum allowed 304 value.
66
INSERT INTO im_test1 VALUES (2, repeat('x', 289));
7-
ERROR: tuple too large for in_memory table "im_test1"
8-
DETAIL: Tuple length 313 is too large for in memory table (max 304)
7+
ERROR: tuple is too large for in-memory table "im_test1"
8+
DETAIL: Tuple length 313 exceeds the maximum allowed 304 value.
99
INSERT INTO im_test1 SELECT id, repeat('x', 280) FROM generate_series(3, 1000) id;
1010
SELECT val, count(*) FROM im_test1 GROUP BY val;
1111
val | count

contrib/in_memory/expected/tuple_limit_1.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
TRUNCATE im_test1;
33
INSERT INTO im_test1 VALUES (1, repeat('x', 281));
44
INSERT INTO im_test1 VALUES (2, repeat('x', 289));
5-
ERROR: tuple too large for in_memory table "im_test1"
6-
DETAIL: Tuple length 309 is too large for in memory table (max 308)
5+
ERROR: tuple is too large for in-memory table "im_test1"
6+
DETAIL: Tuple length 309 exceeds the maximum allowed 308 value.
77
INSERT INTO im_test1 SELECT id, repeat('x', 280) FROM generate_series(3, 1000) id;
88
SELECT val, count(*) FROM im_test1 GROUP BY val;
99
val | count

contrib/in_memory/fdw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ in_memory_fdw_validator(PG_FUNCTION_ARGS)
130130
{
131131
ereport(ERROR,
132132
(errcode(ERRCODE_SYNTAX_ERROR),
133-
errmsg("invalid value for pk: \"%s\"",
133+
errmsg("invalid value for primary key: \"%s\"",
134134
defGetString(def))));
135135
}
136136
/* Temporary forbid secondary indices */
137137
if (list_length(idx) > 1)
138138
{
139139
ereport(ERROR,
140140
(errcode(ERRCODE_SYNTAX_ERROR),
141-
errmsg("doesn't support secondary indices yet: \"%s\"",
141+
errmsg("secondary indices are yet not supported: \"%s\"",
142142
defGetString(def))));
143143
}
144144
/* check collation and op_class names */
@@ -164,7 +164,7 @@ in_memory_fdw_validate_index(List* index_defs, bool pk)
164164
{
165165
ereport(ERROR,
166166
(errcode(ERRCODE_SYNTAX_ERROR),
167-
errmsg("primary key should be unique")));
167+
errmsg("primary key must be unique")));
168168
}
169169

170170
foreach(lcc, lsecond(index_defs))

contrib/in_memory/fdw_descr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,8 @@ im_fdw_cmp_set_key(imRangeKey *sk1, imRangeKey *sk2,
935935

936936
ereport(ERROR,
937937
(errcode(ERRCODE_DATATYPE_MISMATCH),
938-
errmsg("no comparison support function for"
939-
"op_family %s and types %s and %s",
938+
errmsg("no comparison support function found for "
939+
"op_family %s, types %s and %s",
940940
NameStr(opfam->opfname),
941941
format_type_be(sk1->type),
942942
format_type_be(sk2->type))));

contrib/in_memory/fsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,5 @@ report_oom(void)
226226
{
227227
ereport(ERROR,
228228
(errcode(ERRCODE_OUT_OF_MEMORY),
229-
errmsg("failed to get new page: shared pool size exceeded")));
229+
errmsg("failed to get a new page: shared pool size is exceeded")));
230230
}

contrib/in_memory/in_memory--1.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RETURNS text
3535
AS 'MODULE_PATHNAME'
3636
VOLATILE LANGUAGE C;
3737

38-
CREATE FUNCTION in_memory_page_stats(OUT busy_pages int8, OUT free_pages int8, OUT total_pages int8)
38+
CREATE FUNCTION in_memory_page_stats(OUT busy_pages int8, OUT free_pages int8, OUT all_pages int8)
3939
RETURNS record
4040
AS 'MODULE_PATHNAME'
4141
VOLATILE LANGUAGE C;

contrib/in_memory/undo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,5 +281,5 @@ report_undo_overflow(void)
281281
{
282282
ereport(ERROR,
283283
(errcode(ERRCODE_SNAPSHOT_TOO_OLD),
284-
errmsg("failed to add undo record: undo size exceeded")));
284+
errmsg("failed to add an undo record: undo size is exceeded")));
285285
}

contrib/rum/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ bin
1111
include
1212
lib
1313
pip-selfcheck.json
14+
regression*

contrib/rum/META.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "RUM",
3+
"abstract": "RUM index access method",
4+
"description": "RUM is an extended version of GIN (generalized inverted index) access method. Unlike GIN, RUM stores additional information in posting lists/trees besides item pointers. For example, those additional information might be lexemes positions or timestamps. Thanks to that RUM accelerate certain types of queries in orders of magnitude.",
5+
"version": "1.1.0",
6+
"maintainer": [
7+
"Alexander Korotkov <a.korotkov@postgrespro.ru>",
8+
"Oleg Bartunov <o.bartunov@postgrespro.ru>",
9+
"Teodor Sigaev <teodor@postgrespro.ru>",
10+
"Arthur Zakirov <a.zakirov@postgrespro.ru>"
11+
],
12+
"license": {
13+
"PostgreSQL": "http://www.postgresql.org/about/licence"
14+
},
15+
"prereqs": {
16+
"runtime": {
17+
"requires": {
18+
"PostgreSQL": "9.6.0"
19+
},
20+
"recommends": {
21+
"PostgreSQL": "9.6.5"
22+
}
23+
}
24+
},
25+
"provides": {
26+
"rum": {
27+
"file": "rum--1.1.sql",
28+
"docfile": "README.md",
29+
"version": "1.1.0",
30+
"abstract": "RUM index access method"
31+
}
32+
},
33+
"resources": {
34+
"homepage": "https://github.com/postgrespro/rum",
35+
"bugtracker": {
36+
"web": "https://github.com/postgrespro/rum/issues"
37+
},
38+
"repository": {
39+
"url": "https://github.com/postgrespro/rum.git",
40+
"web": "https://github.com/postgrespro/rum",
41+
"type": "git"
42+
}
43+
},
44+
"generated_by": "Alexander Korotkov",
45+
"meta-spec": {
46+
"version": "1.0.0",
47+
"url": "http://pgxn.org/meta/spec.txt"
48+
},
49+
"tags": [
50+
"index",
51+
"search",
52+
"GIN",
53+
"full text",
54+
"additional information"
55+
]
56+
}

contrib/rum/Makefile

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
# contrib/rum/Makefile
22

33
MODULE_big = rum
4+
EXTENSION = rum
5+
EXTVERSION = 1.2
6+
PGFILEDESC = "RUM index access method"
7+
48
OBJS = src/rumsort.o src/rum_ts_utils.o src/rumtsquery.o \
59
src/rumbtree.o src/rumbulk.o src/rumdatapage.o \
610
src/rumentrypage.o src/rumget.o src/ruminsert.o \
711
src/rumscan.o src/rumutil.o src/rumvacuum.o src/rumvalidate.o \
8-
src/btree_rum.o $(WIN32RES)
12+
src/btree_rum.o src/rum_arr_utils.o $(WIN32RES)
913

10-
EXTENSION = rum
11-
DATA = rum--1.0.sql rum--1.0--1.1.sql rum--1.1.sql
12-
PGFILEDESC = "RUM index access method"
13-
INCLUDES = src/rum.h src/rumsort.h
14+
DATA = rum--1.0.sql
15+
DATA_updates = rum--1.0--1.1.sql rum--1.1--1.2.sql
16+
DATA_built = rum--$(EXTVERSION).sql $(DATA_updates)
17+
18+
INCLUDES = rum.h rumsort.h
19+
RELATIVE_INCLUDES = $(addprefix src/, $(INCLUDES))
20+
21+
LDFLAGS_SL += $(filter -lm, $(LIBS))
1422

1523
REGRESS = rum rum_hash ruminv timestamp orderby orderby_hash altorder \
1624
altorder_hash limits \
1725
int2 int4 int8 float4 float8 money oid \
1826
time timetz date interval \
1927
macaddr inet cidr text varchar char bytea bit varbit \
20-
numeric
21-
22-
LDFLAGS_SL += $(filter -lm, $(LIBS))
28+
numeric
2329

2430
ifdef USE_PGXS
2531
PG_CONFIG = pg_config
@@ -32,22 +38,35 @@ include $(top_builddir)/src/Makefile.global
3238
include $(top_srcdir)/contrib/contrib-global.mk
3339
endif
3440

41+
ifeq ($(MAJORVERSION), 9.6)
42+
# arrays are not supported on 9.6
43+
else
44+
REGRESS += array
45+
endif
46+
3547
wal-check: temp-install
3648
$(prove_check)
3749

38-
all: rum--1.1.sql
50+
all: rum--$(EXTVERSION).sql
3951

40-
#9.6 requires 1.1 file but 10.0 could live with 1.0 + 1.0-1.1 files
41-
rum--1.1.sql: rum--1.0.sql rum--1.0--1.1.sql
42-
cat rum--1.0.sql rum--1.0--1.1.sql > rum--1.1.sql
52+
#9.6 requires 1.2 file but 10.0 could live with update files
53+
rum--$(EXTVERSION).sql: $(DATA) $(DATA_updates)
54+
cat $(DATA) $(DATA_updates) > rum--$(EXTVERSION).sql
4355

44-
rum--1.0--1.1.sql: Makefile gen_rum_sql--1.0--1.1.pl
45-
perl gen_rum_sql--1.0--1.1.pl > rum--1.0--1.1.sql
56+
# rule for updates, e.g. rum--1.0--1.1.sql
57+
rum--%.sql: gen_rum_sql--%.pl
58+
perl $< > $@
4659

4760
install: installincludes
4861

4962
installincludes:
50-
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(INCLUDES)) '$(DESTDIR)$(includedir_server)/'
63+
$(INSTALL) -d '$(DESTDIR)$(includedir_server)/'
64+
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(RELATIVE_INCLUDES)) '$(DESTDIR)$(includedir_server)/'
65+
66+
uninstall: uninstallincludes
67+
68+
uninstallincludes:
69+
rm -f $(addprefix '$(DESTDIR)$(includedir_server)/', $(INCLUDES))
5170

5271
ISOLATIONCHECKS= predicate-rum predicate-rum-2
5372

@@ -60,4 +79,4 @@ submake-rum:
6079
isolationcheck: | submake-isolation submake-rum temp-install
6180
$(pg_isolation_regress_check) \
6281
--temp-config $(top_srcdir)/contrib/rum/logical.conf \
63-
$(ISOLATIONCHECKS)
82+
$(ISOLATIONCHECKS)

contrib/rum/README.md

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Typical installation procedure may look like this:
5959
| timestamp &lt;=&#124; timestamp | float8 | Returns distance only for left timestamps.
6060
| timestamp &#124;=&gt; timestamp | float8 | Returns distance only for right timestamps.
6161

62-
Last three operations also works for types int2, int4, int8, float4, float8,
62+
Last three operations also works for types timestamptz, int2, int4, int8, float4, float8,
6363
money and oid.
6464

6565
## Operator classes
@@ -142,7 +142,7 @@ Supported operations: `<`, `<=`, `=`, `>=`, `>` for all types and
142142
timestamp and timestamptz types.
143143

144144
Supports ordering by `<=>`, `<=|` and `|=>` operators. Can be used with
145-
`rum_tsvector_addon_ops` operator class.
145+
`rum_tsvector_addon_ops`, `rum_tsvector_hash_addon_ops' and `rum_anyarray_addon_ops` operator classes.
146146

147147
### rum_tsvector_addon_ops
148148

@@ -221,10 +221,55 @@ SELECT * FROM query
221221
(2 rows)
222222
```
223223

224+
### rum_anyarray_ops
225+
226+
For type: `anyarray`
227+
228+
This operator class stores `anyarrray` elements with length of the array.
229+
Supports operators `&&`, `@>`, `<@`, `=`, `%` operators. Supports ordering by `<=>` operator.
230+
For example we have the table:
231+
232+
```sql
233+
CREATE TABLE test_array (i int2[]);
234+
235+
INSERT INTO test_array VALUES ('{}'), ('{0}'), ('{1,2,3,4}'), ('{1,2,3}'), ('{1,2}'), ('{1}');
236+
237+
CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
238+
```
239+
240+
Now we can execute the query using index scan:
241+
242+
```sql
243+
SET enable_seqscan TO off;
244+
245+
EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
246+
QUERY PLAN
247+
------------------------------------------
248+
Index Scan using idx_array on test_array
249+
Index Cond: (i && '{1}'::smallint[])
250+
Order By: (i <=> '{1}'::smallint[])
251+
(3 rows
252+
253+
SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
254+
i
255+
-----------
256+
{1}
257+
{1,2}
258+
{1,2,3}
259+
{1,2,3,4}
260+
(4 rows)
261+
```
262+
263+
### rum_anyarray_addon_ops
264+
265+
For type: `anyarray`
266+
267+
This operator class stores `anyarrray` elements with any supported by module
268+
field.
269+
224270
## Todo
225271

226272
- Allow multiple additional information (lexemes positions + timestamp).
227-
- Add support for arrays.
228273
- Improve ranking function to support TF/IDF.
229274
- Improve insert time.
230275
- Improve GENERIC WAL to support shift (PostgreSQL core changes).
@@ -233,6 +278,8 @@ SELECT * FROM query
233278

234279
Alexander Korotkov <a.korotkov@postgrespro.ru> Postgres Professional Ltd., Russia
235280

236-
Oleg Bartunov <oleg@sai.msu.su> Postgres Professional Ltd., Russia
281+
Oleg Bartunov <o.bartunov@postgrespro.ru> Postgres Professional Ltd., Russia
282+
283+
Teodor Sigaev <teodor@postgrespro.ru> Postgres Professional Ltd., Russia
237284

238-
Teodor Sigaev <teodor@sigaev.ru> Postgres Professional Ltd., Russia
285+
Arthur Zakirov <a.zakirov@postgrespro.ru> Postgres Professional Ltd., Russia

0 commit comments

Comments
 (0)