Skip to content

Commit e650948

Browse files
authored
Merge pull request #139 from postgres/master
Sync Fork from Upstream Repo
2 parents 872c93d + 6ee3b5f commit e650948

File tree

171 files changed

+6533
-1757
lines changed

Some content is hidden

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

171 files changed

+6533
-1757
lines changed

config/general.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# argument (other than "yes/no"), etc.
99
#
1010
# The point of this implementation is to reduce code size and
11-
# redundancy in configure.in and to improve robustness and consistency
11+
# redundancy in configure.ac and to improve robustness and consistency
1212
# in the option evaluation code.
1313

1414

configure.in renamed to configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl configure.in
2+
dnl configure.ac
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -21,7 +21,7 @@ AC_INIT([PostgreSQL], [14devel], [pgsql-bugs@lists.postgresql.org], [], [https:/
2121

2222
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
2323
Untested combinations of 'autoconf' and PostgreSQL versions are not
24-
recommended. You can remove the check from 'configure.in' but it is then
24+
recommended. You can remove the check from 'configure.ac' but it is then
2525
your responsibility whether the result works or not.])])
2626
AC_COPYRIGHT([Copyright (c) 1996-2020, PostgreSQL Global Development Group])
2727
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])

contrib/amcheck/expected/check_btree.out

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,19 @@ SELECT bt_index_parent_check('delete_test_table_pkey', true);
155155
-- tuple. Bloom filter must fingerprint normalized index tuple representation.
156156
--
157157
CREATE TABLE toast_bug(buggy text);
158-
ALTER TABLE toast_bug ALTER COLUMN buggy SET STORAGE plain;
159-
-- pg_attribute entry for toasty.buggy will have plain storage:
160-
CREATE INDEX toasty ON toast_bug(buggy);
161-
-- Whereas pg_attribute entry for toast_bug.buggy now has extended storage:
162158
ALTER TABLE toast_bug ALTER COLUMN buggy SET STORAGE extended;
159+
CREATE INDEX toasty ON toast_bug(buggy);
160+
-- pg_attribute entry for toasty.buggy (the index) will have plain storage:
161+
UPDATE pg_attribute SET attstorage = 'p'
162+
WHERE attrelid = 'toasty'::regclass AND attname = 'buggy';
163+
-- Whereas pg_attribute entry for toast_bug.buggy (the table) still has extended storage:
164+
SELECT attstorage FROM pg_attribute
165+
WHERE attrelid = 'toast_bug'::regclass AND attname = 'buggy';
166+
attstorage
167+
------------
168+
x
169+
(1 row)
170+
163171
-- Insert compressible heap tuple (comfortably exceeds TOAST_TUPLE_THRESHOLD):
164172
INSERT INTO toast_bug SELECT repeat('a', 2200);
165173
-- Should not get false positive report of corruption:

contrib/amcheck/sql/check_btree.sql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ SELECT bt_index_parent_check('delete_test_table_pkey', true);
9999
-- tuple. Bloom filter must fingerprint normalized index tuple representation.
100100
--
101101
CREATE TABLE toast_bug(buggy text);
102-
ALTER TABLE toast_bug ALTER COLUMN buggy SET STORAGE plain;
103-
-- pg_attribute entry for toasty.buggy will have plain storage:
104-
CREATE INDEX toasty ON toast_bug(buggy);
105-
-- Whereas pg_attribute entry for toast_bug.buggy now has extended storage:
106102
ALTER TABLE toast_bug ALTER COLUMN buggy SET STORAGE extended;
103+
CREATE INDEX toasty ON toast_bug(buggy);
104+
105+
-- pg_attribute entry for toasty.buggy (the index) will have plain storage:
106+
UPDATE pg_attribute SET attstorage = 'p'
107+
WHERE attrelid = 'toasty'::regclass AND attname = 'buggy';
108+
109+
-- Whereas pg_attribute entry for toast_bug.buggy (the table) still has extended storage:
110+
SELECT attstorage FROM pg_attribute
111+
WHERE attrelid = 'toast_bug'::regclass AND attname = 'buggy';
112+
107113
-- Insert compressible heap tuple (comfortably exceeds TOAST_TUPLE_THRESHOLD):
108114
INSERT INTO toast_bug SELECT repeat('a', 2200);
109115
-- Should not get false positive report of corruption:

contrib/bloom/blutils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ blhandler(PG_FUNCTION_ARGS)
139139
amroutine->amproperty = NULL;
140140
amroutine->ambuildphasename = NULL;
141141
amroutine->amvalidate = blvalidate;
142+
amroutine->amadjustmembers = NULL;
142143
amroutine->ambeginscan = blbeginscan;
143144
amroutine->amrescan = blrescan;
144145
amroutine->amgettuple = NULL;

contrib/jsonb_plperl/jsonb_plperl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,8 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
227227
/*
228228
* jsonb doesn't allow infinity or NaN (per JSON
229229
* specification), but the numeric type that is used for the
230-
* storage accepts NaN, so we have to prevent it here
231-
* explicitly. We don't really have to check for isinf()
232-
* here, as numeric doesn't allow it and it would be caught
233-
* later, but it makes for a nicer error message.
230+
* storage accepts those, so we have to reject them here
231+
* explicitly.
234232
*/
235233
if (isinf(nval))
236234
ereport(ERROR,

contrib/jsonb_plpython/jsonb_plpython.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,17 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
387387
pfree(str);
388388

389389
/*
390-
* jsonb doesn't allow NaN (per JSON specification), so we have to prevent
391-
* it here explicitly. (Infinity is also not allowed in jsonb, but
392-
* numeric_in above already catches that.)
390+
* jsonb doesn't allow NaN or infinity (per JSON specification), so we
391+
* have to reject those here explicitly.
393392
*/
394393
if (numeric_is_nan(num))
395394
ereport(ERROR,
396395
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
397396
errmsg("cannot convert NaN to jsonb")));
397+
if (numeric_is_inf(num))
398+
ereport(ERROR,
399+
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
400+
errmsg("cannot convert infinity to jsonb")));
398401

399402
jbvNum->type = jbvNumeric;
400403
jbvNum->val.numeric = num;

contrib/pg_stat_statements/expected/pg_stat_statements.out

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,69 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
528528
SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C" | 0 | 0
529529
(9 rows)
530530

531+
--
532+
-- Track the total number of rows retrieved or affected by the utility
533+
-- commands of COPY, FETCH, CREATE TABLE AS, CREATE MATERIALIZED VIEW
534+
-- and SELECT INTO
535+
--
536+
SELECT pg_stat_statements_reset();
537+
pg_stat_statements_reset
538+
--------------------------
539+
540+
(1 row)
541+
542+
CREATE TABLE pgss_ctas AS SELECT a, 'ctas' b FROM generate_series(1, 10) a;
543+
SELECT generate_series(1, 10) c INTO pgss_select_into;
544+
COPY pgss_ctas (a, b) FROM STDIN;
545+
CREATE MATERIALIZED VIEW pgss_matv AS SELECT * FROM pgss_ctas;
546+
BEGIN;
547+
DECLARE pgss_cursor CURSOR FOR SELECT * FROM pgss_matv;
548+
FETCH NEXT pgss_cursor;
549+
a | b
550+
---+------
551+
1 | ctas
552+
(1 row)
553+
554+
FETCH FORWARD 5 pgss_cursor;
555+
a | b
556+
---+------
557+
2 | ctas
558+
3 | ctas
559+
4 | ctas
560+
5 | ctas
561+
6 | ctas
562+
(5 rows)
563+
564+
FETCH FORWARD ALL pgss_cursor;
565+
a | b
566+
----+------
567+
7 | ctas
568+
8 | ctas
569+
9 | ctas
570+
10 | ctas
571+
11 | copy
572+
12 | copy
573+
13 | copy
574+
(7 rows)
575+
576+
COMMIT;
577+
SELECT query, plans, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
578+
query | plans | calls | rows
579+
-------------------------------------------------------------------------------------+-------+-------+------
580+
BEGIN | 0 | 1 | 0
581+
COMMIT | 0 | 1 | 0
582+
COPY pgss_ctas (a, b) FROM STDIN | 0 | 1 | 3
583+
CREATE MATERIALIZED VIEW pgss_matv AS SELECT * FROM pgss_ctas | 0 | 1 | 13
584+
CREATE TABLE pgss_ctas AS SELECT a, 'ctas' b FROM generate_series(1, 10) a | 0 | 1 | 10
585+
DECLARE pgss_cursor CURSOR FOR SELECT * FROM pgss_matv | 0 | 1 | 0
586+
FETCH FORWARD 5 pgss_cursor | 0 | 1 | 5
587+
FETCH FORWARD ALL pgss_cursor | 0 | 1 | 7
588+
FETCH NEXT pgss_cursor | 0 | 1 | 1
589+
SELECT generate_series(1, 10) c INTO pgss_select_into | 0 | 1 | 10
590+
SELECT pg_stat_statements_reset() | 0 | 1 | 1
591+
SELECT query, plans, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C" | 1 | 0 | 0
592+
(12 rows)
593+
531594
--
532595
-- Track user activity and reset them
533596
--
@@ -728,6 +791,9 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
728791
--
729792
DROP ROLE regress_stats_user1;
730793
DROP ROLE regress_stats_user2;
794+
DROP MATERIALIZED VIEW pgss_matv;
795+
DROP TABLE pgss_ctas;
796+
DROP TABLE pgss_select_into;
731797
--
732798
-- [re]plan counting
733799
--

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,15 @@ pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
11701170
INSTR_TIME_SET_CURRENT(duration);
11711171
INSTR_TIME_SUBTRACT(duration, start);
11721172

1173-
rows = (qc && qc->commandTag == CMDTAG_COPY) ? qc->nprocessed : 0;
1173+
/*
1174+
* Track the total number of rows retrieved or affected by
1175+
* the utility statements of COPY, FETCH, CREATE TABLE AS,
1176+
* CREATE MATERIALIZED VIEW and SELECT INTO.
1177+
*/
1178+
rows = (qc && (qc->commandTag == CMDTAG_COPY ||
1179+
qc->commandTag == CMDTAG_FETCH ||
1180+
qc->commandTag == CMDTAG_SELECT)) ?
1181+
qc->nprocessed : 0;
11741182

11751183
/* calc differences of buffer counters. */
11761184
memset(&bufusage, 0, sizeof(BufferUsage));

contrib/pg_stat_statements/sql/pg_stat_statements.sql

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,30 @@ DROP FUNCTION PLUS_TWO(INTEGER);
250250

251251
SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
252252

253+
--
254+
-- Track the total number of rows retrieved or affected by the utility
255+
-- commands of COPY, FETCH, CREATE TABLE AS, CREATE MATERIALIZED VIEW
256+
-- and SELECT INTO
257+
--
258+
SELECT pg_stat_statements_reset();
259+
260+
CREATE TABLE pgss_ctas AS SELECT a, 'ctas' b FROM generate_series(1, 10) a;
261+
SELECT generate_series(1, 10) c INTO pgss_select_into;
262+
COPY pgss_ctas (a, b) FROM STDIN;
263+
11 copy
264+
12 copy
265+
13 copy
266+
\.
267+
CREATE MATERIALIZED VIEW pgss_matv AS SELECT * FROM pgss_ctas;
268+
BEGIN;
269+
DECLARE pgss_cursor CURSOR FOR SELECT * FROM pgss_matv;
270+
FETCH NEXT pgss_cursor;
271+
FETCH FORWARD 5 pgss_cursor;
272+
FETCH FORWARD ALL pgss_cursor;
273+
COMMIT;
274+
275+
SELECT query, plans, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
276+
253277
--
254278
-- Track user activity and reset them
255279
--
@@ -313,6 +337,9 @@ SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";
313337
--
314338
DROP ROLE regress_stats_user1;
315339
DROP ROLE regress_stats_user2;
340+
DROP MATERIALIZED VIEW pgss_matv;
341+
DROP TABLE pgss_ctas;
342+
DROP TABLE pgss_select_into;
316343

317344
--
318345
-- [re]plan counting

0 commit comments

Comments
 (0)