pgsql: Provide XLogRecGetFullXid().

2019-07-14 Thread Thomas Munro
Provide XLogRecGetFullXid().

In order to be able to work with FullTransactionId values during replay
without increasing the size of the WAL, infer the epoch.  In general we
can't do that safely, but during replay we can because we know that
nextFullXid can't advance concurrently.

Prevent frontend code from seeing this new function, due to the above
restriction.  Perhaps in future it will be possible to extract the value
entirely from independent WAL records, and then this restriction can be
lifted.

Author: Thomas Munro, based on earlier code from Andres Freund
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BmLmuDjMi6o1dxkKvGRL56Y2Rz%2BiXAcrZV03G9ZuFQ8Q%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/67b9b3ca328392f9afc4e66fe03564f5fc87feff

Modified Files
--
src/backend/access/transam/xlogreader.c | 35 +
src/include/access/xlogreader.h |  8 
2 files changed, 43 insertions(+)



pgsql: Add gen_random_uuid function

2019-07-14 Thread Peter Eisentraut
Add gen_random_uuid function

This adds a built-in function to generate UUIDs.

PostgreSQL hasn't had a built-in function to generate a UUID yet,
relying on external modules such as uuid-ossp and pgcrypto to provide
one.  Now that we have a strong random number generator built-in, we
can easily provide a version 4 (random) UUID generation function.

This patch takes the existing function gen_random_uuid() from pgcrypto
and makes it a built-in function.  The pgcrypto implementation now
internally redirects to the built-in one.

Reviewed-by: Fabien COELHO 
Discussion: 
https://www.postgresql.org/message-id/6a65610c-46fc-2323-6b78-e8086340a...@2ndquadrant.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5925e5549890416bcf588334d9d0bc99f8ad6c7f

Modified Files
--
contrib/pgcrypto/pgcrypto.c  | 16 ++--
doc/src/sgml/datatype.sgml   | 12 ++--
doc/src/sgml/func.sgml   | 26 ++
doc/src/sgml/pgcrypto.sgml   |  3 ++-
doc/src/sgml/uuid-ossp.sgml  | 11 +++
src/backend/utils/adt/uuid.c | 20 
src/include/catalog/catversion.h |  2 +-
src/include/catalog/pg_proc.dat  |  3 +++
src/test/regress/expected/opr_sanity.out |  1 +
src/test/regress/expected/uuid.out   | 10 ++
src/test/regress/sql/uuid.sql|  6 ++
11 files changed, 76 insertions(+), 34 deletions(-)



Re: pgsql: Forgotten catversion bump

2019-07-14 Thread Alexander Korotkov
On Sun, Jul 14, 2019 at 3:28 PM Alexander Korotkov
 wrote:
> 6254c55f81, c085e1c1cb and 075f0a880f all change system catalog.  But
> catversion bump is missed in all of them.  So, do catversion bump now.
>
> Also, I need mention patch reviewer Fabien Coelho, who has been missed in
> commit messages of 6254c55f81, c085e1c1cb and 075f0a880f.

Sorry for both these oversights...

--
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




pgsql: Forgotten catversion bump

2019-07-14 Thread Alexander Korotkov
Forgotten catversion bump

6254c55f81, c085e1c1cb and 075f0a880f all change system catalog.  But
catversion bump is missed in all of them.  So, do catversion bump now.

Also, I need mention patch reviewer Fabien Coelho, who has been missed in
commit messages of 6254c55f81, c085e1c1cb and 075f0a880f.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/565f3390005318ea4c982b8d054d56e9fe5a6454

Modified Files
--
src/include/catalog/catversion.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Add support for <-> (box, point) operator to SP-GiST box_ops

2019-07-14 Thread Alexander Korotkov
Add support for <-> (box, point) operator to SP-GiST box_ops

Opclass support functions already can handle this operator, just catalog
adjustment appears to be required.

Discussion: 
https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Tom Lane, Alexander Korotkov

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/075f0a880fbf790f4a3dcac83e2d5125bcad9646

Modified Files
--
doc/src/sgml/spgist.sgml   |  1 +
src/include/catalog/pg_amop.dat|  4 ++
src/test/regress/expected/box.out  | 82 +-
src/test/regress/expected/sanity_check.out |  2 +
src/test/regress/sql/box.sql   | 70 -
5 files changed, 135 insertions(+), 24 deletions(-)



pgsql: Add missing commutators for distance operators

2019-07-14 Thread Alexander Korotkov
Add missing commutators for distance operators

Some of <-> operators between geometric types have their commutators missed.
This commit adds them.  The motivation is upcoming kNN support for some of those
operators.

Discussion: 
https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Tom Lane, Alexander Korotkov

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6254c55f815623bb74e2cf27562437dc3b2aa2c8

Modified Files
--
src/backend/utils/adt/geo_ops.c| 136 -
src/include/catalog/pg_operator.dat|  42 +-
src/include/catalog/pg_proc.dat|  25 +
src/test/regress/expected/geometry.out | 986 +
src/test/regress/sql/geometry.sql  |  15 +-
5 files changed, 687 insertions(+), 517 deletions(-)



pgsql: Add support for <-> (box, point) operator to GiST box_ops

2019-07-14 Thread Alexander Korotkov
Add support for <-> (box, point) operator to GiST box_ops

Index-based calculation of this operator is exact.  So, signature of
gist_bbox_distance() function is changes so that caller is responsible for
setting *recheck flag.

Discussion: 
https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Tom Lane, Alexander Korotkov

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c085e1c1cb4e29637552f5d250d45ad0cb83e5cf

Modified Files
--
doc/src/sgml/gist.sgml |  1 +
src/backend/access/gist/gistproc.c | 48 +++-
src/include/catalog/pg_amop.dat|  3 ++
src/include/catalog/pg_amproc.dat  |  2 +
src/include/catalog/pg_proc.dat|  4 ++
src/test/regress/expected/gist.out | 76 ++
src/test/regress/sql/gist.sql  | 16 
7 files changed, 133 insertions(+), 17 deletions(-)



pgsql: Teach pg_stat_statements not to ignore FOR UPDATE clauses

2019-07-14 Thread Andrew Gierth
Teach pg_stat_statements not to ignore FOR UPDATE clauses

Performance of a SELECT FOR UPDATE may be quite distinct from the
non-UPDATE version of the query, so treat all of the FOR UPDATE clause
as being significant for distinguishing queries.

Andrew Gierth and Vik Fearing, reviewed by Sergei Kornilov, Thomas
Munro, Tom Lane

Discussion: https://postgr.es/m/87h8e4hfwv@news-spur.riddles.org.uk

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6e74c64bcf61eab94091f6b17dfd0ab585b1a77e

Modified Files
--
.../expected/pg_stat_statements.out| 87 ++
contrib/pg_stat_statements/pg_stat_statements.c| 23 +-
.../pg_stat_statements/sql/pg_stat_statements.sql  | 31 
3 files changed, 140 insertions(+), 1 deletion(-)