Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f40898b
Doc: Fix link to fillfactor reloption.
petergeoghegan May 10, 2023
969961f
Ensure Soundex difference() function handles empty input sanely.
tglsfdc May 16, 2023
eafdb7d
Fix handling of NULLs when merging BRIN summaries
tvondra May 18, 2023
e4e5b26
pageinspect: Fix gist_page_items() with included columns
michaelpq May 19, 2023
8bb1ac2
Avoid naming conflict between transactions.sql and namespace.sql.
tglsfdc May 19, 2023
284c2d6
nbtree VACUUM: cope with right sibling link corruption.
petergeoghegan May 25, 2023
6d7f2bb
doc: add missing "the" in LATERAL sentence.
bmomjian Jun 1, 2023
d86b6fd
Fix pg_dump's failure to honor dependencies of SQL functions.
tglsfdc Jun 4, 2023
963e268
Doc: explain about dependency tracking for new-style SQL functions.
tglsfdc Jun 4, 2023
e0d7695
Use per-tuple context in ExecGetAllUpdatedCols
tvondra Jun 7, 2023
b3bc41d
doc: Fix example command for ALTER FOREIGN TABLE ... OPTIONS.
MasaoFujii Jun 8, 2023
50ff8fb
Refactor log check logic for connect_ok/fails in PostgreSQL::Test::Cl…
michaelpq Jun 9, 2023
c257e28
Fix missing initializations of MyProc.delayChkptEnd
michaelpq Jun 11, 2023
c821196
hstore: Tighten key/value parsing check for whitespaces
michaelpq Jun 12, 2023
f5cd2cb
Accept fractional seconds in jsonpath's datetime() method.
tglsfdc Jun 12, 2023
d5725ae
Correctly update hasSubLinks while mutating a rule action.
tglsfdc Jun 13, 2023
bf80a09
intarray: Prevent out-of-bound memory reads with gist__int_ops
michaelpq Jun 15, 2023
76fbad1
Fix typo in comment.
amitlan Jun 16, 2023
4faba31
Don't use partial unique indexes for unique proofs in the planner
david-rowley Jun 19, 2023
d45544b
Enable archiving in recovery TAP test 009_twophase.pl
michaelpq Jun 20, 2023
0354946
Fix hash join when inner hashkey expressions contain Params.
tglsfdc Jun 20, 2023
4f334af
Fix the errhint message and docs for drop subscription failure.
Jun 21, 2023
52395f2
Disable use of archiving in 009_twophase.pl
michaelpq Jun 21, 2023
6d6cdf5
Avoid Assert failure when processing empty statement in aborted xact.
tglsfdc Jun 21, 2023
be977c8
doc: update PG history as over "three decades"
bmomjian Jun 21, 2023
1eac917
nbtree VACUUM: cope with topparent inconsistencies.
petergeoghegan Jun 22, 2023
46661f6
Doc: mention that extended stats aren't used for joins
david-rowley Jun 22, 2023
8b65e43
Doc: Clarify the behavior of triggers/rules in a logical subscriber.
Jun 22, 2023
e38c85a
Fix incorrect error message in libpq_pipeline
michaelpq Jun 23, 2023
2347be5
doc: rename "decades" to be more generic
bmomjian Jun 24, 2023
986f577
Check for interrupts and stack overflow in TParserGet().
tglsfdc Jun 24, 2023
e4863e5
Fix comment on clearing padding.
hlinnaka Jun 27, 2023
2919478
Ignore invalid indexes when enforcing index rules in ALTER TABLE ATTA…
michaelpq Jun 28, 2023
603707e
pg_stat_statements: Fix incorrect comment with entry resets
michaelpq Jun 28, 2023
bd8faa4
pg_stat_statements: Fix second comment related to entry resets
michaelpq Jun 29, 2023
5ddd5e1
Remove inappropriate raw_expression_tree_walker() code
petere Jun 29, 2023
5707952
Fix order of operations in ExecEvalFieldStoreDeForm().
tglsfdc Jun 29, 2023
073c5f0
Fix marking of indisvalid for partitioned indexes at creation
michaelpq Jun 30, 2023
4ee20e9
doc: PG _14_ relnotes, remove duplicate commit comment
bmomjian Jun 30, 2023
56b9e0e
Fix memory leak in Incremental Sort rescans
tvondra Jul 2, 2023
e1a2e5f
Fix oversight in handling of modifiedCols since f24523672d
tvondra Jul 2, 2023
d642fd2
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests
michaelpq Jul 3, 2023
20b2f14
Improve pg_basebackup long file name test Windows robustness
adunstan Jul 3, 2023
f3cf04c
Use older package name in pg_basebackup test
adunstan Jul 3, 2023
038e734
Remove expensive test of postgres_fdw batch inserts
tvondra Jul 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contrib/fuzzystrmatch/expected/fuzzystrmatch.out
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ SELECT soundex('Anne'), soundex('Margaret'), difference('Anne', 'Margaret');
A500 | M626 | 0
(1 row)

SELECT soundex(''), difference('', '');
soundex | difference
---------+------------
| 4
(1 row)

SELECT levenshtein('GUMBO', 'GAMBOL');
levenshtein
-------------
Expand Down
15 changes: 8 additions & 7 deletions contrib/fuzzystrmatch/fuzzystrmatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,16 +727,14 @@ _soundex(const char *instr, char *outstr)
AssertArg(instr);
AssertArg(outstr);

outstr[SOUNDEX_LEN] = '\0';

/* Skip leading non-alphabetic characters */
while (!isalpha((unsigned char) instr[0]) && instr[0])
while (*instr && !isalpha((unsigned char) *instr))
++instr;

/* No string left */
if (!instr[0])
/* If no string left, return all-zeroes buffer */
if (!*instr)
{
outstr[0] = (char) 0;
memset(outstr, '\0', SOUNDEX_LEN + 1);
return;
}

Expand All @@ -749,7 +747,7 @@ _soundex(const char *instr, char *outstr)
if (isalpha((unsigned char) *instr) &&
soundex_code(*instr) != soundex_code(*(instr - 1)))
{
*outstr = soundex_code(instr[0]);
*outstr = soundex_code(*instr);
if (*outstr != '0')
{
++outstr;
Expand All @@ -766,6 +764,9 @@ _soundex(const char *instr, char *outstr)
++outstr;
++count;
}

/* And null-terminate */
*outstr = '\0';
}

PG_FUNCTION_INFO_V1(difference);
Expand Down
1 change: 1 addition & 0 deletions contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SELECT soundex('hello world!');
SELECT soundex('Anne'), soundex('Ann'), difference('Anne', 'Ann');
SELECT soundex('Anne'), soundex('Andrew'), difference('Anne', 'Andrew');
SELECT soundex('Anne'), soundex('Margaret'), difference('Anne', 'Margaret');
SELECT soundex(''), difference('', '');


SELECT levenshtein('GUMBO', 'GAMBOL');
Expand Down
2 changes: 1 addition & 1 deletion contrib/hstore/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PGFILEDESC = "hstore - key/value pair data type"

HEADERS = hstore.h

REGRESS = hstore
REGRESS = hstore hstore_utf8

ifdef USE_PGXS
PG_CONFIG = pg_config
Expand Down
36 changes: 36 additions & 0 deletions contrib/hstore/expected/hstore_utf8.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This test must be run in a database with UTF-8 encoding,
* because other encodings don't support all the characters used.
*/
SELECT getdatabaseencoding() <> 'UTF8'
AS skip_test \gset
\if :skip_test
\quit
\endif
SET client_encoding = utf8;
-- UTF-8 locale bug on macOS: isspace(0x85) returns true. \u0105 encodes
-- as 0xc4 0x85 in UTF-8; the 0x85 was interpreted here as a whitespace.
SELECT E'key\u0105=>value\u0105'::hstore;
hstore
------------------
"keyą"=>"valueą"
(1 row)

SELECT 'keyą=>valueą'::hstore;
hstore
------------------
"keyą"=>"valueą"
(1 row)

SELECT 'ą=>ą'::hstore;
hstore
----------
"ą"=>"ą"
(1 row)

SELECT 'keyąfoo=>valueą'::hstore;
hstore
---------------------
"keyąfoo"=>"valueą"
(1 row)

8 changes: 8 additions & 0 deletions contrib/hstore/expected/hstore_utf8_1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* This test must be run in a database with UTF-8 encoding,
* because other encodings don't support all the characters used.
*/
SELECT getdatabaseencoding() <> 'UTF8'
AS skip_test \gset
\if :skip_test
\quit
9 changes: 5 additions & 4 deletions contrib/hstore/hstore_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "hstore.h"
#include "lib/stringinfo.h"
#include "libpq/pqformat.h"
#include "parser/scansup.h"
#include "utils/builtins.h"
#include "utils/json.h"
#include "utils/jsonb.h"
Expand Down Expand Up @@ -88,7 +89,7 @@ get_val(HSParser *state, bool ignoreeq, bool *escaped)
{
st = GV_WAITESCIN;
}
else if (!isspace((unsigned char) *(state->ptr)))
else if (!scanner_isspace((unsigned char) *(state->ptr)))
{
*(state->cur) = *(state->ptr);
state->cur++;
Expand All @@ -111,7 +112,7 @@ get_val(HSParser *state, bool ignoreeq, bool *escaped)
state->ptr--;
return true;
}
else if (isspace((unsigned char) *(state->ptr)))
else if (scanner_isspace((unsigned char) *(state->ptr)))
{
return true;
}
Expand Down Expand Up @@ -219,7 +220,7 @@ parse_hstore(HSParser *state)
{
elog(ERROR, "Unexpected end of string");
}
else if (!isspace((unsigned char) *(state->ptr)))
else if (!scanner_isspace((unsigned char) *(state->ptr)))
{
elog(ERROR, "Syntax error near \"%.*s\" at position %d",
pg_mblen(state->ptr), state->ptr,
Expand Down Expand Up @@ -271,7 +272,7 @@ parse_hstore(HSParser *state)
{
return;
}
else if (!isspace((unsigned char) *(state->ptr)))
else if (!scanner_isspace((unsigned char) *(state->ptr)))
{
elog(ERROR, "Syntax error near \"%.*s\" at position %d",
pg_mblen(state->ptr), state->ptr,
Expand Down
19 changes: 19 additions & 0 deletions contrib/hstore/sql/hstore_utf8.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* This test must be run in a database with UTF-8 encoding,
* because other encodings don't support all the characters used.
*/

SELECT getdatabaseencoding() <> 'UTF8'
AS skip_test \gset
\if :skip_test
\quit
\endif

SET client_encoding = utf8;

-- UTF-8 locale bug on macOS: isspace(0x85) returns true. \u0105 encodes
-- as 0xc4 0x85 in UTF-8; the 0x85 was interpreted here as a whitespace.
SELECT E'key\u0105=>value\u0105'::hstore;
SELECT 'keyą=>valueą'::hstore;
SELECT 'ą=>ą'::hstore;
SELECT 'keyąfoo=>valueą'::hstore;
12 changes: 8 additions & 4 deletions contrib/intarray/_int_gist.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ g_int_compress(PG_FUNCTION_ARGS)
PREPAREARR(r);

if (ARRNELEMS(r) >= 2 * num_ranges)
elog(NOTICE, "input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
2 * num_ranges - 1, ARRNELEMS(r));
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("input array is too big (%d maximum allowed, %d current), use gist__intbig_ops opclass instead",
2 * num_ranges - 1, ARRNELEMS(r))));

retval = palloc(sizeof(GISTENTRY));
gistentryinit(*retval, PointerGetDatum(r),
Expand Down Expand Up @@ -269,7 +271,8 @@ g_int_compress(PG_FUNCTION_ARGS)
lenr = internal_size(dr, len);
if (lenr < 0 || lenr > MAXNUMELTS)
ereport(ERROR,
(errmsg("data is too sparse, recreate index using gist__intbig_ops opclass instead")));
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("data is too sparse, recreate index using gist__intbig_ops opclass instead")));

r = resize_intArrayType(r, len);
retval = palloc(sizeof(GISTENTRY));
Expand Down Expand Up @@ -331,7 +334,8 @@ g_int_decompress(PG_FUNCTION_ARGS)
lenr = internal_size(din, lenin);
if (lenr < 0 || lenr > MAXNUMELTS)
ereport(ERROR,
(errmsg("compressed array is too big, recreate index using gist__intbig_ops opclass instead")));
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("compressed array is too big, recreate index using gist__intbig_ops opclass instead")));

r = new_intArrayType(lenr);
dr = ARRPTR(r);
Expand Down
2 changes: 2 additions & 0 deletions contrib/intarray/expected/_int.out
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ SELECT count(*) from test__int WHERE a @@ '!20 & !21';
6343
(1 row)

INSERT INTO test__int SELECT array(SELECT x FROM generate_series(1, 1001) x); -- should fail
ERROR: input array is too big (199 maximum allowed, 1001 current), use gist__intbig_ops opclass instead
DROP INDEX text_idx;
CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 0));
ERROR: value 0 out of bounds for option "numranges"
Expand Down
2 changes: 2 additions & 0 deletions contrib/intarray/sql/_int.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ SELECT count(*) from test__int WHERE a @@ '(20&23)|(50&68)';
SELECT count(*) from test__int WHERE a @@ '20 | !21';
SELECT count(*) from test__int WHERE a @@ '!20 & !21';

INSERT INTO test__int SELECT array(SELECT x FROM generate_series(1, 1001) x); -- should fail

DROP INDEX text_idx;
CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 0));
CREATE INDEX text_idx on test__int using gist (a gist__int_ops(numranges = 1021));
Expand Down
52 changes: 40 additions & 12 deletions contrib/pageinspect/expected/gist.out
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@ SELECT * FROM gist_page_opaque_info(get_raw_page('test_gist_idx', 2));

COMMIT;
SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 0), 'test_gist_idx');
itemoffset | ctid | itemlen | dead | keys
------------+-----------+---------+------+-------------------
1 | (1,65535) | 40 | f | (p)=((669,669))
2 | (2,65535) | 40 | f | (p)=((1000,1000))
(2 rows)
itemoffset | ctid | itemlen | dead | keys
------------+-----------+---------+------+-------------------------------
1 | (1,65535) | 40 | f | (p)=("(166,166),(1,1)")
2 | (2,65535) | 40 | f | (p)=("(332,332),(167,167)")
3 | (3,65535) | 40 | f | (p)=("(498,498),(333,333)")
4 | (4,65535) | 40 | f | (p)=("(664,664),(499,499)")
5 | (5,65535) | 40 | f | (p)=("(830,830),(665,665)")
6 | (6,65535) | 40 | f | (p)=("(996,996),(831,831)")
7 | (7,65535) | 40 | f | (p)=("(1000,1000),(997,997)")
(7 rows)

SELECT * FROM gist_page_items(get_raw_page('test_gist_idx', 1), 'test_gist_idx') LIMIT 5;
itemoffset | ctid | itemlen | dead | keys
------------+-------+---------+------+-------------
1 | (0,1) | 40 | f | (p)=((1,1))
2 | (0,2) | 40 | f | (p)=((2,2))
3 | (0,3) | 40 | f | (p)=((3,3))
4 | (0,4) | 40 | f | (p)=((4,4))
5 | (0,5) | 40 | f | (p)=((5,5))
itemoffset | ctid | itemlen | dead | keys
------------+-------+---------+------+---------------------
1 | (0,1) | 40 | f | (p)=("(1,1),(1,1)")
2 | (0,2) | 40 | f | (p)=("(2,2),(2,2)")
3 | (0,3) | 40 | f | (p)=("(3,3),(3,3)")
4 | (0,4) | 40 | f | (p)=("(4,4),(4,4)")
5 | (0,5) | 40 | f | (p)=("(5,5),(5,5)")
(5 rows)

-- gist_page_items_bytea prints the raw key data as a bytea. The output of that is
Expand Down Expand Up @@ -99,4 +104,27 @@ SELECT gist_page_opaque_info(decode(repeat('00', :block_size), 'hex'));

(1 row)

-- Test gist_page_items with included columns.
-- Non-leaf pages contain only the key attributes, and leaf pages contain
-- the included attributes.
ALTER TABLE test_gist ADD COLUMN i int DEFAULT NULL;
CREATE INDEX test_gist_idx_inc ON test_gist
USING gist (p) INCLUDE (t, i);
-- Mask the value of the key attribute to avoid alignment issues.
SELECT regexp_replace(keys, '\(p\)=\("(.*?)"\)', '(p)=("<val>")') AS keys_nonleaf_1
FROM gist_page_items(get_raw_page('test_gist_idx_inc', 0), 'test_gist_idx_inc')
WHERE itemoffset = 1;
keys_nonleaf_1
----------------
(p)=("<val>")
(1 row)

SELECT keys AS keys_leaf_1
FROM gist_page_items(get_raw_page('test_gist_idx_inc', 1), 'test_gist_idx_inc')
WHERE itemoffset = 1;
keys_leaf_1
------------------------------------------------------
(p) INCLUDE (t, i)=("(1,1),(1,1)") INCLUDE (1, null)
(1 row)

DROP TABLE test_gist;
Loading
Loading