[COMMITTERS] pgsql: Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion

2016-01-03 Thread Tom Lane
Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion condition.

pgwin32_recv() has treated a non-error return of zero bytes from WSARecv()
as being a reason to block ever since the current implementation was
introduced in commit a4c40f140d23cefb.  However, so far as one can tell
from Microsoft's documentation, that is just wrong: what it means is
graceful connection closure (in stream protocols) or receipt of a
zero-length message (in message protocols), and neither case should result
in blocking here.  The only reason the code worked at all was that control
then fell into the retry loop, which did *not* treat zero bytes specially,
so we'd get out after only wasting some cycles.  But as of 9.5 we do not
normally reach the retry loop and so the bug is exposed, as reported by
Shay Rojansky and diagnosed by Andres Freund.

Remove the unnecessary test on the byte count, and rearrange the code
in the retry loop so that it looks identical to the initial sequence.

Back-patch to 9.5.  The code is wrong all the way back, AFAICS, but
since it's relatively harmless in earlier branches we'll leave it alone.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/90e61df8130dc7051a108ada1219fb0680cb3eb6

Modified Files
--
src/backend/port/win32/socket.c |   37 -
1 file changed, 16 insertions(+), 21 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion

2016-01-03 Thread Tom Lane
Fix treatment of *lpNumberOfBytesRecvd == 0: that's a completion condition.

pgwin32_recv() has treated a non-error return of zero bytes from WSARecv()
as being a reason to block ever since the current implementation was
introduced in commit a4c40f140d23cefb.  However, so far as one can tell
from Microsoft's documentation, that is just wrong: what it means is
graceful connection closure (in stream protocols) or receipt of a
zero-length message (in message protocols), and neither case should result
in blocking here.  The only reason the code worked at all was that control
then fell into the retry loop, which did *not* treat zero bytes specially,
so we'd get out after only wasting some cycles.  But as of 9.5 we do not
normally reach the retry loop and so the bug is exposed, as reported by
Shay Rojansky and diagnosed by Andres Freund.

Remove the unnecessary test on the byte count, and rearrange the code
in the retry loop so that it looks identical to the initial sequence.

Back-patch to 9.5.  The code is wrong all the way back, AFAICS, but
since it's relatively harmless in earlier branches we'll leave it alone.

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/29692bdbb1dffed0eda38ad8268655425a7dcdf5

Modified Files
--
src/backend/port/win32/socket.c |   37 -
1 file changed, 16 insertions(+), 21 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Do a final round of copy-editing on the 9.5 release notes.

2016-01-03 Thread Tom Lane
Do a final round of copy-editing on the 9.5 release notes.

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/78d0e582ab1087d0cde9d00d8c8994591ae3c955

Modified Files
--
doc/src/sgml/release-9.5.sgml |  179 ++---
1 file changed, 97 insertions(+), 82 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Do a final round of copy-editing on the 9.5 release notes.

2016-01-03 Thread Tom Lane
Do a final round of copy-editing on the 9.5 release notes.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/027989197aab9e555328721b003ebd1839a16704

Modified Files
--
doc/src/sgml/release-9.5.sgml |  179 ++---
1 file changed, 97 insertions(+), 82 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Do some copy-editing on the docs for replication origins.

2016-01-03 Thread Tom Lane
Do some copy-editing on the docs for replication origins.

Minor grammar and markup improvements.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/c6aeba353a15d71f584488a7482fb88337f843e3

Modified Files
--
doc/src/sgml/func.sgml|   39 ++-
doc/src/sgml/replication-origins.sgml |   47 ++---
2 files changed, 46 insertions(+), 40 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Do some copy-editing on the docs for replication origins.

2016-01-03 Thread Tom Lane
Do some copy-editing on the docs for replication origins.

Minor grammar and markup improvements.

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/2e5c9284f688d124b0169ff5b86003ca86842666

Modified Files
--
doc/src/sgml/func.sgml|   39 ++-
doc/src/sgml/replication-origins.sgml |   47 ++---
2 files changed, 46 insertions(+), 40 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Guard against null arguments in binary_upgrade_create_empty_exte

2016-01-03 Thread Tom Lane
Guard against null arguments in binary_upgrade_create_empty_extension().

The CHECK_IS_BINARY_UPGRADE macro is not sufficient security protection
if we're going to dereference pass-by-reference arguments before it.

But in any case we really need to explicitly check PG_ARGISNULL for all
the arguments of a non-strict function, not only the ones we expect null
values for.

Oversight in commits 30982be4e5019684e1772dd9170aaa53f5a8e894 and
f92fc4c95ddcc25978354a8248d3df22269201bc.  Found by Andreas Seltenreich.
(The other usages in pg_upgrade_support.c seem safe.)

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/ab1f08a3a4a855cb9245456866918706ca2fdf06

Modified Files
--
src/backend/utils/adt/pg_upgrade_support.c |   20 
1 file changed, 16 insertions(+), 4 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Guard against null arguments in binary_upgrade_create_empty_exte

2016-01-03 Thread Tom Lane
Guard against null arguments in binary_upgrade_create_empty_extension().

The CHECK_IS_BINARY_UPGRADE macro is not sufficient security protection
if we're going to dereference pass-by-reference arguments before it.

But in any case we really need to explicitly check PG_ARGISNULL for all
the arguments of a non-strict function, not only the ones we expect null
values for.

Oversight in commits 30982be4e5019684e1772dd9170aaa53f5a8e894 and
f92fc4c95ddcc25978354a8248d3df22269201bc.  Found by Andreas Seltenreich.
(The other usages in pg_upgrade_support.c seem safe.)

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/939d10cd8711fdeb7f0ff62c9c6b08e3eddbba3e

Modified Files
--
src/backend/utils/adt/pg_upgrade_support.c |   20 
1 file changed, 16 insertions(+), 4 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Do some copy-editing on the docs for row-level security.

2016-01-03 Thread Tom Lane
Do some copy-editing on the docs for row-level security.

Clarifications, markup improvements, corrections of misleading or
outright wrong statements.

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/35adf6e44cb65111f7caf5a9988c0738790ef02d

Modified Files
--
doc/src/sgml/ddl.sgml   |  178 ++
doc/src/sgml/ref/alter_policy.sgml  |   23 +++-
doc/src/sgml/ref/create_policy.sgml |  241 +++
doc/src/sgml/ref/drop_policy.sgml   |9 +-
4 files changed, 246 insertions(+), 205 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Do some copy-editing on the docs for row-level security.

2016-01-03 Thread Tom Lane
Do some copy-editing on the docs for row-level security.

Clarifications, markup improvements, corrections of misleading or
outright wrong statements.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/c1611db01fec587525e88270854c4b993846dcb3

Modified Files
--
doc/src/sgml/ddl.sgml   |  154 --
doc/src/sgml/ref/alter_policy.sgml  |   23 +++-
doc/src/sgml/ref/create_policy.sgml |  241 +++
doc/src/sgml/ref/drop_policy.sgml   |9 +-
4 files changed, 234 insertions(+), 193 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix bogus lock release in RemovePolicyById and RemoveRoleFromObj

2016-01-03 Thread Tom Lane
Fix bogus lock release in RemovePolicyById and RemoveRoleFromObjectPolicy.

Can't release the AccessExclusiveLock on the target table until commit.
Otherwise there is a race condition whereby other backends might service
our cache invalidation signals before they can actually see the updated
catalog rows.

Just to add insult to injury, RemovePolicyById was closing the rel (with
incorrect lock drop) and then passing the now-dangling rel pointer to
CacheInvalidateRelcache.  Probably the reason this doesn't fall over on
CLOBBER_CACHE buildfarm members is that some outer level of the DROP logic
is still holding the rel open ... but it'd have bit us on the arse
eventually, no doubt.

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/c244a511ba7f40dd43516eb025b1b299f2978f23

Modified Files
--
src/backend/commands/policy.c |   15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix bogus lock release in RemovePolicyById and RemoveRoleFromObj

2016-01-03 Thread Tom Lane
Fix bogus lock release in RemovePolicyById and RemoveRoleFromObjectPolicy.

Can't release the AccessExclusiveLock on the target table until commit.
Otherwise there is a race condition whereby other backends might service
our cache invalidation signals before they can actually see the updated
catalog rows.

Just to add insult to injury, RemovePolicyById was closing the rel (with
incorrect lock drop) and then passing the now-dangling rel pointer to
CacheInvalidateRelcache.  Probably the reason this doesn't fall over on
CLOBBER_CACHE buildfarm members is that some outer level of the DROP logic
is still holding the rel open ... but it'd have bit us on the arse
eventually, no doubt.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/f47b602df80d7647ca2e71c86f7228b1bf5bf9f3

Modified Files
--
src/backend/commands/policy.c |   15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix regrole and regnamespace types to honor quoting like other r

2016-01-03 Thread Tom Lane
Fix regrole and regnamespace types to honor quoting like other reg* types.

Aside from any consistency arguments, this is logically necessary because
the I/O functions for these types also handle numeric OID values.  Without
a quoting rule it is impossible to distinguish numeric OIDs from role or
namespace names that happen to contain only digits.

Also change the to_regrole and to_regnamespace functions to dequote their
arguments.  While not logically essential, this seems like a good idea
since the other to_reg* functions do it.  Anyone who really wants raw
lookup of an uninterpreted name can fall back on the time-honored solution
of (SELECT oid FROM pg_namespace WHERE nspname = whatever).

Report and patch by Jim Nasby, reviewed by Michael Paquier

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/fb1227af67eae5e97795f7e3563673c6e67d2844

Modified Files
--
src/backend/utils/adt/regproc.c   |   48 --
src/test/regress/expected/regproc.out |  169 -
src/test/regress/sql/regproc.sql  |   44 +++--
3 files changed, 201 insertions(+), 60 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix regrole and regnamespace types to honor quoting like other r

2016-01-03 Thread Tom Lane
Fix regrole and regnamespace types to honor quoting like other reg* types.

Aside from any consistency arguments, this is logically necessary because
the I/O functions for these types also handle numeric OID values.  Without
a quoting rule it is impossible to distinguish numeric OIDs from role or
namespace names that happen to contain only digits.

Also change the to_regrole and to_regnamespace functions to dequote their
arguments.  While not logically essential, this seems like a good idea
since the other to_reg* functions do it.  Anyone who really wants raw
lookup of an uninterpreted name can fall back on the time-honored solution
of (SELECT oid FROM pg_namespace WHERE nspname = whatever).

Report and patch by Jim Nasby, reviewed by Michael Paquier

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/fa038f830b64779475b746a6840db9bdd0298d80

Modified Files
--
src/backend/utils/adt/regproc.c   |   48 --
src/test/regress/expected/regproc.out |  169 -
src/test/regress/sql/regproc.sql  |   44 +++--
3 files changed, 201 insertions(+), 60 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix regrole and regnamespace output functions to do quoting, too

2016-01-03 Thread Tom Lane
Fix regrole and regnamespace output functions to do quoting, too.

We discussed this but somehow failed to implement it...

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/de93252386e25b78400228b08326a50c43dd232b

Modified Files
--
src/backend/utils/adt/regproc.c |   16 ++--
1 file changed, 14 insertions(+), 2 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix regrole and regnamespace output functions to do quoting, too

2016-01-03 Thread Tom Lane
Fix regrole and regnamespace output functions to do quoting, too.

We discussed this but somehow failed to implement it...

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/b0cadc08fea564f75a0702e15b2bd949377bd2f3

Modified Files
--
src/backend/utils/adt/regproc.c |   16 ++--
1 file changed, 14 insertions(+), 2 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers