Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
d1754ac
Doc: improve tutorial section about grouped aggregates.
tglsfdc Nov 8, 2022
8317a3f
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.
tglsfdc Nov 9, 2022
5fa9f1b
Fix comment of SimpleLruInit() in slru.c
michaelpq Nov 10, 2022
e40d131
Fix comments atop ReorderBufferAddInvalidations.
Nov 10, 2022
af0ba46
Re-allow building on Microsoft Visual Studio 2013.
tglsfdc Nov 10, 2022
881c5c4
Fix alter_table.sql test case to test what it claims to.
tglsfdc Nov 10, 2022
8c5f592
Fix theoretical torn page hazard.
jeff-davis Nov 10, 2022
d3a9bd7
Fix cleanup lock acquisition in SPLIT_ALLOCATE_PAGE replay.
Nov 14, 2022
514dc90
Account for IPC::Run::result() Windows behavior change.
nmisch Nov 17, 2022
371722f
Fix version comparison in Version.pm
adunstan Nov 18, 2022
eedb0f7
pg_dump: avoid unsafe function calls in getPolicies().
tglsfdc Nov 19, 2022
66c744c
Doc: sync src/tutorial/basics.source with SGML documentation.
tglsfdc Nov 19, 2022
0f5d6d5
Fix mislabeling of PROC_QUEUE->links as PGPROC, fixing UBSan on 32bit
anarazel Nov 17, 2022
033b0fc
Prevent instability in contrib/pageinspect's regression test.
tglsfdc Nov 21, 2022
9fa1470
Revert "Prevent instability in contrib/pageinspect's regression test."
tglsfdc Nov 21, 2022
98a1135
Add comments and a missing CHECK_FOR_INTERRUPTS in ts_headline.
tglsfdc Nov 21, 2022
1d9a3b6
Replace link to Hunspell with the current homepage
danielgustafsson Nov 21, 2022
fac042d
YA attempt at taming worst-case behavior of get_actual_variable_range.
tglsfdc Nov 22, 2022
6ff7389
Make multixact error message more explicit
alvherre Nov 24, 2022
f849b59
Fix uninitialized access to InitialRunningXacts during decoding.
Nov 25, 2022
44636b0
Remove temporary portlock directory during make [dist]clean.
tglsfdc Nov 26, 2022
d240b26
Fix binary mismatch for MSVC plperl vs gcc built perl libs
adunstan Nov 27, 2022
37c2b49
Remove bogus Assert and dead code in remove_useless_results_recurse().
tglsfdc Nov 29, 2022
305491a
Prevent clobbering of utility statements in SQL function caches.
tglsfdc Nov 29, 2022
33e7161
Improve heuristics for compressing the KnownAssignedXids array.
tglsfdc Nov 29, 2022
59b2d60
Fix comment in fe-auth-scram.c
michaelpq Nov 29, 2022
f4800c6
doc: add transaction processing chapter with internals info
bmomjian Nov 30, 2022
19fb3c0
Reject missing database name in pg_regress and cohorts.
tglsfdc Nov 30, 2022
accad05
revert: add transaction processing chapter with internals info
bmomjian Dec 1, 2022
1088e95
Fix under-parenthesized display of AT TIME ZONE constructs.
tglsfdc Dec 1, 2022
cf47030
Doc: add example of round(v, s) with negative s.
tglsfdc Dec 1, 2022
29ac3a5
Fix memory leak for hashing with nondeterministic collations.
jeff-davis Dec 1, 2022
1fa66f8
Fix psql's \sf and \ef for new-style SQL functions.
tglsfdc Dec 2, 2022
f964fb7
Fix DEFAULT handling for multi-row INSERT rules.
deanrasheed Dec 3, 2022
fffb3bc
Fix generate_partitionwise_join_paths() to tolerate failure.
tglsfdc Dec 4, 2022
dd54841
Fix broken MemoizePath support in reparameterize_path().
tglsfdc Dec 4, 2022
7d21f8b
doc: Add missing <varlistentry> markups for developer GUCs
michaelpq Dec 5, 2022
600b6b9
Fix Memoize to work with partitionwise joining.
tglsfdc Dec 5, 2022
feaabfc
Fix jsonb subscripting to cope with toasted subscript values.
tglsfdc Dec 12, 2022
a48c1f6
Rethink handling of [Prevent|Is]InTransactionBlock in pipeline mode.
tglsfdc Dec 13, 2022
d287d97
Re-adjust drop-index-concurrently-1 isolation test
david-rowley Dec 15, 2022
852ef67
Fix contrib/seg to be more wary of long input numbers.
tglsfdc Dec 21, 2022
66a9673
Add some recursion and looping defenses in prepjointree.c.
tglsfdc Dec 22, 2022
0af4563
Fix come incorrect elog() messages in aclchk.c
michaelpq Dec 23, 2022
46fff78
Fix event trigger example
alvherre Dec 23, 2022
a18396e
Fix assert in BRIN build_distances
tvondra Dec 30, 2022
6bb4abe
Avoid reference to nonexistent array element in ExecInitAgg().
tglsfdc Jan 2, 2023
834d9cb
Fix typos in comments, code and documentation
michaelpq Jan 3, 2023
e1ba739
Improve documentation of the CREATEROLE attibute.
robertmhaas Jan 3, 2023
752cc77
Fix pg_truncate() on Windows.
macdice Jan 6, 2023
18709f3
Fix tab completion of ALTER FUNCTION/PROCEDURE/ROUTINE ... SET SCHEMA.
deanrasheed Jan 6, 2023
6bc8292
Remove the streaming files for incomplete xacts after restart.
Jan 7, 2023
a8cddbd
Fix jsonpath existense checking of missing variables
akorotkov Jan 12, 2023
60836d4
Fix WaitEventSetWait() buffer overrun.
macdice Jan 12, 2023
cdf7369
Fix some BufFileRead() error reporting
petere Jan 16, 2023
795a4cd
Fix failure with perlcritic in psql's create_help.pl
michaelpq Jan 19, 2023
591b0dd
Add missing assign hook for GUC checkpoint_completion_target
michaelpq Jan 19, 2023
bcbaf35
Log the correct ending timestamp in recovery_target_xid mode.
tglsfdc Jan 19, 2023
b549299
Reject CancelRequestPacket having unexpected length.
nmisch Jan 21, 2023
553178a
Allow REPLICA IDENTITY to be set on an index that's not (yet) valid.
tglsfdc Jan 21, 2023
6f2b504
Fix error handling in libpqrcv_connect()
anarazel Jan 24, 2023
c961434
Fix the Drop Database hang.
Jan 24, 2023
ae559a3
doc: Fix network_ops -> inet_ops in SpGiST operator class list
michaelpq Jan 25, 2023
2acdb02
Fix rare sharedtuplestore.c corruption.
macdice Jan 26, 2023
ca4c172
Remove recovery test 011_crash_recovery.pl
michaelpq Jan 31, 2023
1b141f9
Doc: clarify use of NULL to drop comments and security labels.
tglsfdc Jan 31, 2023
3940366
Update time zone data files to tzdata release 2022g.
tglsfdc Jan 31, 2023
b8431d5
Doc: Abstract AF_UNIX sockets don't work on Windows.
macdice Feb 2, 2023
e8ca834
doc: Fix XML formatting that psql cannot handle
petere Feb 3, 2023
50a00dc
Release notes for 15.2, 14.7, 13.10, 12.14, 11.19.
tglsfdc Feb 5, 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
4 changes: 2 additions & 2 deletions GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ $(call recurse,distprep coverage,doc src config contrib gpcontrib)
# it's not built by default
$(call recurse,clean,doc contrib gpcontrib src config)
clean:
rm -rf tmp_install/
rm -rf tmp_install/ portlock/
# Garbage from autoconf:
@rm -rf autom4te.cache/
# leap over gpAux/Makefile into subdirectories to avoid circular dependency.
Expand All @@ -132,7 +132,7 @@ distclean maintainer-clean:
$(MAKE) -C config $@
$(MAKE) -C gpMgmt $@
$(MAKE) -C src $@
rm -rf tmp_install/
rm -rf tmp_install/ portlock/
# Garbage from autoconf:
@rm -rf autom4te.cache/
rm -f config.cache config.log config.status GNUmakefile
Expand Down
7 changes: 7 additions & 0 deletions contrib/seg/expected/seg.out
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ SELECT '12.34567890123456'::seg AS seg;
12.3457
(1 row)

-- Same, with a very long input
SELECT '12.3456789012345600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'::seg AS seg;
seg
---------
12.3457
(1 row)

-- Numbers with certainty indicators
SELECT '~6.5'::seg AS seg;
seg
Expand Down
8 changes: 6 additions & 2 deletions contrib/seg/seg.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,13 @@ restore(char *result, float val, int n)

/*
* Put a cap on the number of significant digits to avoid garbage in the
* output and ensure we don't overrun the result buffer.
* output and ensure we don't overrun the result buffer. (n should not be
* negative, but check to protect ourselves against corrupted data.)
*/
n = Min(n, FLT_DIG);
if (n <= 0)
n = FLT_DIG;
else
n = Min(n, FLT_DIG);

/* remember the sign */
sign = (val < 0 ? 1 : 0);
Expand Down
22 changes: 17 additions & 5 deletions contrib/seg/segparse.y
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "postgres.h"

#include <float.h>
#include <math.h>

#include "fmgr.h"
Expand All @@ -23,6 +24,8 @@

static float seg_atof(const char *value);

static int sig_digits(const char *value);

static char strbuf[25] = {
'0', '0', '0', '0', '0',
'0', '0', '0', '0', '0',
Expand Down Expand Up @@ -63,9 +66,9 @@ range: boundary PLUMIN deviation
result->lower = $1.val - $3.val;
result->upper = $1.val + $3.val;
sprintf(strbuf, "%g", result->lower);
result->l_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
result->l_sigd = Max(sig_digits(strbuf), Max($1.sigd, $3.sigd));
sprintf(strbuf, "%g", result->upper);
result->u_sigd = Max(Min(6, significant_digits(strbuf)), Max($1.sigd, $3.sigd));
result->u_sigd = Max(sig_digits(strbuf), Max($1.sigd, $3.sigd));
result->l_ext = '\0';
result->u_ext = '\0';
}
Expand Down Expand Up @@ -122,7 +125,7 @@ boundary: SEGFLOAT
float val = seg_atof($1);

$$.ext = '\0';
$$.sigd = significant_digits($1);
$$.sigd = sig_digits($1);
$$.val = val;
}
| EXTENSION SEGFLOAT
Expand All @@ -131,7 +134,7 @@ boundary: SEGFLOAT
float val = seg_atof($2);

$$.ext = $1[0];
$$.sigd = significant_digits($2);
$$.sigd = sig_digits($2);
$$.val = val;
}
;
Expand All @@ -142,7 +145,7 @@ deviation: SEGFLOAT
float val = seg_atof($1);

$$.ext = '\0';
$$.sigd = significant_digits($1);
$$.sigd = sig_digits($1);
$$.val = val;
}
;
Expand All @@ -159,5 +162,14 @@ seg_atof(const char *value)
return DatumGetFloat4(datum);
}

static int
sig_digits(const char *value)
{
int n = significant_digits(value);

/* Clamp, to ensure value will fit in sigd fields */
return Min(n, FLT_DIG);
}


#include "segscan.c"
3 changes: 3 additions & 0 deletions contrib/seg/sql/seg.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ SELECT '3.400e5'::seg AS seg;
-- Digits truncated
SELECT '12.34567890123456'::seg AS seg;

-- Same, with a very long input
SELECT '12.3456789012345600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'::seg AS seg;

-- Numbers with certainty indicators
SELECT '~6.5'::seg AS seg;
SELECT '<6.5'::seg AS seg;
Expand Down
16 changes: 8 additions & 8 deletions doc/src/sgml/config.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ include_dir 'conf.d'
<para>
A value that starts with <literal>@</literal> specifies that a
Unix-domain socket in the abstract namespace should be created
(currently supported on Linux and Windows). In that case, this value
(currently supported on Linux only). In that case, this value
does not specify a <quote>directory</quote> but a prefix from which
the actual socket name is computed in the same manner as for the
file-system namespace. While the abstract socket name prefix can be
Expand Down Expand Up @@ -10734,7 +10734,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-trace-locks" xreflabel="trace_locks">
<term><varname>trace_locks</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>trace_locks</varname> configuration parameter</primary>
Expand Down Expand Up @@ -10775,7 +10775,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-trace-lwlocks" xreflabel="trace_lwlocks">
<term><varname>trace_lwlocks</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>trace_lwlocks</varname> configuration parameter</primary>
Expand All @@ -10795,7 +10795,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-trace-userlocks" xreflabel="trace_userlocks">
<term><varname>trace_userlocks</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>trace_userlocks</varname> configuration parameter</primary>
Expand All @@ -10814,7 +10814,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-trace-lock-oidmin" xreflabel="trace_lock_oidmin">
<term><varname>trace_lock_oidmin</varname> (<type>integer</type>)
<indexterm>
<primary><varname>trace_lock_oidmin</varname> configuration parameter</primary>
Expand All @@ -10833,7 +10833,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-trace-lock-table" xreflabel="trace_lock_table">
<term><varname>trace_lock_table</varname> (<type>integer</type>)
<indexterm>
<primary><varname>trace_lock_table</varname> configuration parameter</primary>
Expand All @@ -10851,7 +10851,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-debug-deadlocks" xreflabel="debug_deadlocks">
<term><varname>debug_deadlocks</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>debug_deadlocks</varname> configuration parameter</primary>
Expand All @@ -10870,7 +10870,7 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
</listitem>
</varlistentry>

<varlistentry>
<varlistentry id="guc-log-btree-build-stats" xreflabel="log_btree_build_stats">
<term><varname>log_btree_build_stats</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>log_btree_build_stats</varname> configuration parameter</primary>
Expand Down
5 changes: 3 additions & 2 deletions doc/src/sgml/event-trigger.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -1194,8 +1194,9 @@ noddl(PG_FUNCTION_ARGS)
trigdata = (EventTriggerData *) fcinfo->context;

ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("command \"%s\" denied", trigdata->tag)));
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("command \"%s\" denied",
GetCommandTagName(trigdata->tag))));

PG_RETURN_NULL();
}
Expand Down
4 changes: 4 additions & 0 deletions doc/src/sgml/func.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
<para>
<literal>round(42.4382, 2)</literal>
<returnvalue>42.44</returnvalue>
</para>
<para>
<literal>round(1234.56, -1)</literal>
<returnvalue>1230</returnvalue>
</para></entry>
</row>

Expand Down
5 changes: 3 additions & 2 deletions doc/src/sgml/libpq.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -5024,10 +5024,11 @@ int PQflush(PGconn *conn);
</para>

<para>
While the pipeline API was introduced in
While <application>libpq</application>'s pipeline API was introduced in
<productname>PostgreSQL</productname> 14, it is a client-side feature
which doesn't require special server support and works on any server
that supports the v3 extended query protocol.
that supports the v3 extended query protocol. For more information see
<xref linkend="protocol-flow-pipelining"/>.
</para>

<sect2 id="libpq-pipeline-using">
Expand Down
2 changes: 1 addition & 1 deletion doc/src/sgml/parallel.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';

<para>
In addition, the system must not be running in single-user mode. Since
the entire database system is running in single process in this situation,
the entire database system is running as a single process in this situation,
no background workers will be available.
</para>

Expand Down
9 changes: 5 additions & 4 deletions doc/src/sgml/protocol.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -1093,17 +1093,18 @@ SELCT 1/0;<!-- this typo is intentional -->
implicit <command>ROLLBACK</command> if they failed. However, there
are a few DDL commands (such as <command>CREATE DATABASE</command>)
that cannot be executed inside a transaction block. If one of
these is executed in a pipeline, it will, upon success, force an
immediate commit to preserve database consistency.
A Sync immediately following one of these has no effect except to
these is executed in a pipeline, it will fail unless it is the first
command in the pipeline. Furthermore, upon success it will force an
immediate commit to preserve database consistency. Thus a Sync
immediately following one of these commands has no effect except to
respond with ReadyForQuery.
</para>

<para>
When using this method, completion of the pipeline must be determined
by counting ReadyForQuery messages and waiting for that to reach the
number of Syncs sent. Counting command completion responses is
unreliable, since some of the commands may not be executed and thus not
unreliable, since some of the commands may be skipped and thus not
produce a completion message.
</para>
</sect2>
Expand Down
65 changes: 49 additions & 16 deletions doc/src/sgml/query.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -706,40 +706,39 @@ SELECT city FROM weather
<indexterm><primary>HAVING</primary></indexterm>

Aggregates are also very useful in combination with <literal>GROUP
BY</literal> clauses. For example, we can get the maximum low
temperature observed in each city with:
BY</literal> clauses. For example, we can get the number of readings
and the maximum low temperature observed in each city with:

<programlisting>
SELECT city, max(temp_lo)
SELECT city, count(*), max(temp_lo)
FROM weather
GROUP BY city;
</programlisting>

<screen>
city | max
---------------+-----
Hayward | 37
San Francisco | 46
city | count | max
---------------+-------+-----
Hayward | 1 | 37
San Francisco | 2 | 46
(2 rows)
</screen>

which gives us one output row per city. Each aggregate result is
computed over the table rows matching that city.
We can filter these grouped
rows using <literal>HAVING</literal> and the output count using
<literal>FILTER</literal>:
rows using <literal>HAVING</literal>:

<programlisting>
SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo &lt; 30)
SELECT city, count(*), max(temp_lo)
FROM weather
GROUP BY city
HAVING max(temp_lo) &lt; 40;
</programlisting>

<screen>
city | max | count
---------+-----+-------
Hayward | 37 | 5
city | count | max
---------+-------+-----
Hayward | 1 | 37
(1 row)
</screen>

Expand All @@ -749,12 +748,18 @@ SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo &lt; 30)
names begin with <quote><literal>S</literal></quote>, we might do:

<programlisting>
SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo &lt; 30)
SELECT city, count(*), max(temp_lo)
FROM weather
WHERE city LIKE 'S%' -- <co id="co.tutorial-agg-like"/>
GROUP BY city
HAVING max(temp_lo) &lt; 40;
GROUP BY city;
</programlisting>

<screen>
city | count | max
---------------+-------+-----
San Francisco | 2 | 46
(1 row)
</screen>
<calloutlist>
<callout arearefs="co.tutorial-agg-like">
<para>
Expand Down Expand Up @@ -791,6 +796,34 @@ SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo &lt; 30)
because we avoid doing the grouping and aggregate calculations
for all rows that fail the <literal>WHERE</literal> check.
</para>

<para>
Another way to select the rows that go into an aggregate
computation is to use <literal>FILTER</literal>, which is a
per-aggregate option:

<programlisting>
SELECT city, count(*) FILTER (WHERE temp_lo &lt; 45), max(temp_lo)
FROM weather
GROUP BY city;
</programlisting>

<screen>
city | count | max
---------------+-------+-----
Hayward | 1 | 37
San Francisco | 1 | 46
(2 rows)
</screen>

<literal>FILTER</literal> is much like <literal>WHERE</literal>,
except that it removes rows only from the input of the particular
aggregate function that it is attached to.
Here, the <literal>count</literal> aggregate counts only
rows with <literal>temp_lo</literal> below 45; but the
<literal>max</literal> aggregate is still applied to all rows,
so it still finds the reading of 46.
</para>
</sect1>


Expand Down
2 changes: 1 addition & 1 deletion doc/src/sgml/ref/alter_role.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ ALTER ROLE fred VALID UNTIL 'infinity';
</para>

<para>
Give a role the ability to create other roles and new databases:
Give a role the ability to manage other roles and create new databases:

<programlisting>
ALTER ROLE miriam CREATEROLE CREATEDB;
Expand Down
2 changes: 1 addition & 1 deletion doc/src/sgml/ref/alter_table.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ Where column_reference_storage_directive is:
constraint. This does not work, however, if any of the partition keys
is an expression and the partition does not accept
<literal>NULL</literal> values. If attaching a list partition that will
not accept <literal>NULL</literal> values, also add
not accept <literal>NULL</literal> values, also add a
<literal>NOT NULL</literal> constraint to the partition key column,
unless it's an expression.
</para>
Expand Down
Loading
Loading