[COMMITTERS] pgsql: pg_dump: Properly handle public schema ACLs with --clean

2017-03-06 Thread Stephen Frost
pg_dump: Properly handle public schema ACLs with --clean

pg_dump has always handled the public schema in a special way when it
comes to the "--clean" option.  To wit, we do not drop or recreate the
public schema in "normal" mode, but when we are run in "--clean" mode
then we do drop and recreate the public schema.

When running in "--clean" mode, the public schema is dropped and then
recreated and it is recreated with the normal schema-default privileges
of "nothing".  This is unlike how the public schema starts life, which
is to have CREATE and USAGE GRANT'd to the PUBLIC role, and that is what
is recorded in pg_init_privs.

Due to this, in "--clean" mode, pg_dump would mistakenly only dump out
the set of privileges required to go from the initdb-time privileges on
the public schema to whatever the current-state privileges are.  If the
privileges were not changed from initdb time, then no privileges would
be dumped out for the public schema, but with the schema being dropped
and recreated, the result was that the public schema would have no ACLs
on it instead of what it should have, which is the initdb-time
privileges.

Practically speaking, this meant that pg_dump with --clean mode dumping
a database where the ACLs on the public schema were not changed from the
default would, upon restore, result in a public schema with *no*
privileges GRANT'd, not matching the state of the existing database
(where the initdb-time privileges would have been CREATE and USAGE to
the PUBLIC role for the public schema).

To fix, adjust the query in getNamespaces() to ignore the pg_init_privs
entry for the public schema when running in "--clean" mode, meaning that
the privileges for the public schema would be dumped, correctly, as if
it was going from a newly-created schema to the current state (which is,
indeed, what will happen during the restore thanks to the DROP/CREATE).

Only the public schema is handled in this special way by pg_dump, no
other initdb-time objects are dropped/recreated in --clean mode.

Back-patch to 9.6 where the bug was introduced.

Discussion: https://postgr.es/m/3534542.o3cNaKiDID%40techfox

Branch
--
REL9_6_STABLE

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

Modified Files
--
src/bin/pg_dump/pg_dump.c| 22 +-
src/bin/pg_dump/t/002_pg_dump.pl | 26 --
2 files changed, 45 insertions(+), 3 deletions(-)


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


[COMMITTERS] pgsql: pg_dump: Properly handle public schema ACLs with --clean

2017-03-06 Thread Stephen Frost
pg_dump: Properly handle public schema ACLs with --clean

pg_dump has always handled the public schema in a special way when it
comes to the "--clean" option.  To wit, we do not drop or recreate the
public schema in "normal" mode, but when we are run in "--clean" mode
then we do drop and recreate the public schema.

When running in "--clean" mode, the public schema is dropped and then
recreated and it is recreated with the normal schema-default privileges
of "nothing".  This is unlike how the public schema starts life, which
is to have CREATE and USAGE GRANT'd to the PUBLIC role, and that is what
is recorded in pg_init_privs.

Due to this, in "--clean" mode, pg_dump would mistakenly only dump out
the set of privileges required to go from the initdb-time privileges on
the public schema to whatever the current-state privileges are.  If the
privileges were not changed from initdb time, then no privileges would
be dumped out for the public schema, but with the schema being dropped
and recreated, the result was that the public schema would have no ACLs
on it instead of what it should have, which is the initdb-time
privileges.

Practically speaking, this meant that pg_dump with --clean mode dumping
a database where the ACLs on the public schema were not changed from the
default would, upon restore, result in a public schema with *no*
privileges GRANT'd, not matching the state of the existing database
(where the initdb-time privileges would have been CREATE and USAGE to
the PUBLIC role for the public schema).

To fix, adjust the query in getNamespaces() to ignore the pg_init_privs
entry for the public schema when running in "--clean" mode, meaning that
the privileges for the public schema would be dumped, correctly, as if
it was going from a newly-created schema to the current state (which is,
indeed, what will happen during the restore thanks to the DROP/CREATE).

Only the public schema is handled in this special way by pg_dump, no
other initdb-time objects are dropped/recreated in --clean mode.

Back-patch to 9.6 where the bug was introduced.

Discussion: https://postgr.es/m/3534542.o3cNaKiDID%40techfox

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/330b84d8c40864007833e05dc9d849c4bda77240

Modified Files
--
src/bin/pg_dump/pg_dump.c| 22 +-
src/bin/pg_dump/t/002_pg_dump.pl | 32 ++--
2 files changed, 51 insertions(+), 3 deletions(-)


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


[COMMITTERS] pgsql: Repair incorrect pg_dump labeling for some comments and security

2017-03-06 Thread Tom Lane
Repair incorrect pg_dump labeling for some comments and security labels.

We attached no schema label to comments for procedural languages, casts,
transforms, operator classes, operator families, or text search objects.
The first three categories of objects don't really have schemas, but
pg_dump treats them as if they do, and it seems like the TocEntry fields
for their comments had better match the TocEntry fields for the parent
objects.  (As an example of a possible hazard, the type names in a CAST
will be formatted with the assumption of a particular search_path, so
failing to ensure that this same path is active for the COMMENT ON command
could lead to an error or to attaching the comment to the wrong cast.)
In the last six cases, this was a flat-out error --- possibly mine to
begin with, but it was a long time ago.

The security label for a procedural language was likewise not correctly
labeled as to schema, and both the comment and security label for a
procedural language were not correctly labeled as to owner.

In simple cases the restore would accidentally work correctly anyway, since
these comments and security labels would normally get emitted right after
the owning object, and so the search path and active user would be correct
anyhow.  But it could fail in corner cases; for example a schema-selective
restore would omit comments it should include.

Giuseppe Broccolo noted the oversight, and proposed the correct fix, for
text search dictionary objects; I found the rest by cross-checking other
dumpComment() calls.  These oversights are ancient, so back-patch all
the way.

Discussion: 
https://postgr.es/m/cafzmhiwwwzljzwm4x5ki5s_pdmr6nrkipzkjnno3b0xepbg...@mail.gmail.com

Branch
--
REL9_3_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/783acfd4dc9f320c4650e8f1b50ba09534edba15

Modified Files
--
src/bin/pg_dump/pg_dump.c | 18 +-
1 file changed, 9 insertions(+), 9 deletions(-)


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


[COMMITTERS] pgsql: Repair incorrect pg_dump labeling for some comments and security

2017-03-06 Thread Tom Lane
Repair incorrect pg_dump labeling for some comments and security labels.

We attached no schema label to comments for procedural languages, casts,
transforms, operator classes, operator families, or text search objects.
The first three categories of objects don't really have schemas, but
pg_dump treats them as if they do, and it seems like the TocEntry fields
for their comments had better match the TocEntry fields for the parent
objects.  (As an example of a possible hazard, the type names in a CAST
will be formatted with the assumption of a particular search_path, so
failing to ensure that this same path is active for the COMMENT ON command
could lead to an error or to attaching the comment to the wrong cast.)
In the last six cases, this was a flat-out error --- possibly mine to
begin with, but it was a long time ago.

The security label for a procedural language was likewise not correctly
labeled as to schema, and both the comment and security label for a
procedural language were not correctly labeled as to owner.

In simple cases the restore would accidentally work correctly anyway, since
these comments and security labels would normally get emitted right after
the owning object, and so the search path and active user would be correct
anyhow.  But it could fail in corner cases; for example a schema-selective
restore would omit comments it should include.

Giuseppe Broccolo noted the oversight, and proposed the correct fix, for
text search dictionary objects; I found the rest by cross-checking other
dumpComment() calls.  These oversights are ancient, so back-patch all
the way.

Discussion: 
https://postgr.es/m/cafzmhiwwwzljzwm4x5ki5s_pdmr6nrkipzkjnno3b0xepbg...@mail.gmail.com

Branch
--
REL9_6_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/8ea8178cd451a23dc9fd51e4e091426cdab6bec6

Modified Files
--
src/bin/pg_dump/pg_dump.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)


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


[COMMITTERS] pgsql: Repair incorrect pg_dump labeling for some comments and security

2017-03-06 Thread Tom Lane
Repair incorrect pg_dump labeling for some comments and security labels.

We attached no schema label to comments for procedural languages, casts,
transforms, operator classes, operator families, or text search objects.
The first three categories of objects don't really have schemas, but
pg_dump treats them as if they do, and it seems like the TocEntry fields
for their comments had better match the TocEntry fields for the parent
objects.  (As an example of a possible hazard, the type names in a CAST
will be formatted with the assumption of a particular search_path, so
failing to ensure that this same path is active for the COMMENT ON command
could lead to an error or to attaching the comment to the wrong cast.)
In the last six cases, this was a flat-out error --- possibly mine to
begin with, but it was a long time ago.

The security label for a procedural language was likewise not correctly
labeled as to schema, and both the comment and security label for a
procedural language were not correctly labeled as to owner.

In simple cases the restore would accidentally work correctly anyway, since
these comments and security labels would normally get emitted right after
the owning object, and so the search path and active user would be correct
anyhow.  But it could fail in corner cases; for example a schema-selective
restore would omit comments it should include.

Giuseppe Broccolo noted the oversight, and proposed the correct fix, for
text search dictionary objects; I found the rest by cross-checking other
dumpComment() calls.  These oversights are ancient, so back-patch all
the way.

Discussion: 
https://postgr.es/m/cafzmhiwwwzljzwm4x5ki5s_pdmr6nrkipzkjnno3b0xepbg...@mail.gmail.com

Branch
--
REL9_2_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/0ab75448eadec9712716276bb4a09d8e6a70f20c

Modified Files
--
src/bin/pg_dump/pg_dump.c | 18 +-
1 file changed, 9 insertions(+), 9 deletions(-)


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


[COMMITTERS] pgsql: Repair incorrect pg_dump labeling for some comments and security

2017-03-06 Thread Tom Lane
Repair incorrect pg_dump labeling for some comments and security labels.

We attached no schema label to comments for procedural languages, casts,
transforms, operator classes, operator families, or text search objects.
The first three categories of objects don't really have schemas, but
pg_dump treats them as if they do, and it seems like the TocEntry fields
for their comments had better match the TocEntry fields for the parent
objects.  (As an example of a possible hazard, the type names in a CAST
will be formatted with the assumption of a particular search_path, so
failing to ensure that this same path is active for the COMMENT ON command
could lead to an error or to attaching the comment to the wrong cast.)
In the last six cases, this was a flat-out error --- possibly mine to
begin with, but it was a long time ago.

The security label for a procedural language was likewise not correctly
labeled as to schema, and both the comment and security label for a
procedural language were not correctly labeled as to owner.

In simple cases the restore would accidentally work correctly anyway, since
these comments and security labels would normally get emitted right after
the owning object, and so the search path and active user would be correct
anyhow.  But it could fail in corner cases; for example a schema-selective
restore would omit comments it should include.

Giuseppe Broccolo noted the oversight, and proposed the correct fix, for
text search dictionary objects; I found the rest by cross-checking other
dumpComment() calls.  These oversights are ancient, so back-patch all
the way.

Discussion: 
https://postgr.es/m/cafzmhiwwwzljzwm4x5ki5s_pdmr6nrkipzkjnno3b0xepbg...@mail.gmail.com

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/20ba16ab75b09b7fed61322f1f23fdc7cf4c

Modified Files
--
src/bin/pg_dump/pg_dump.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)


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


[COMMITTERS] pgsql: Repair incorrect pg_dump labeling for some comments and security

2017-03-06 Thread Tom Lane
Repair incorrect pg_dump labeling for some comments and security labels.

We attached no schema label to comments for procedural languages, casts,
transforms, operator classes, operator families, or text search objects.
The first three categories of objects don't really have schemas, but
pg_dump treats them as if they do, and it seems like the TocEntry fields
for their comments had better match the TocEntry fields for the parent
objects.  (As an example of a possible hazard, the type names in a CAST
will be formatted with the assumption of a particular search_path, so
failing to ensure that this same path is active for the COMMENT ON command
could lead to an error or to attaching the comment to the wrong cast.)
In the last six cases, this was a flat-out error --- possibly mine to
begin with, but it was a long time ago.

The security label for a procedural language was likewise not correctly
labeled as to schema, and both the comment and security label for a
procedural language were not correctly labeled as to owner.

In simple cases the restore would accidentally work correctly anyway, since
these comments and security labels would normally get emitted right after
the owning object, and so the search path and active user would be correct
anyhow.  But it could fail in corner cases; for example a schema-selective
restore would omit comments it should include.

Giuseppe Broccolo noted the oversight, and proposed the correct fix, for
text search dictionary objects; I found the rest by cross-checking other
dumpComment() calls.  These oversights are ancient, so back-patch all
the way.

Discussion: 
https://postgr.es/m/cafzmhiwwwzljzwm4x5ki5s_pdmr6nrkipzkjnno3b0xepbg...@mail.gmail.com

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/bin/pg_dump/pg_dump.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)


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


[COMMITTERS] pgsql: Repair incorrect pg_dump labeling for some comments and security

2017-03-06 Thread Tom Lane
Repair incorrect pg_dump labeling for some comments and security labels.

We attached no schema label to comments for procedural languages, casts,
transforms, operator classes, operator families, or text search objects.
The first three categories of objects don't really have schemas, but
pg_dump treats them as if they do, and it seems like the TocEntry fields
for their comments had better match the TocEntry fields for the parent
objects.  (As an example of a possible hazard, the type names in a CAST
will be formatted with the assumption of a particular search_path, so
failing to ensure that this same path is active for the COMMENT ON command
could lead to an error or to attaching the comment to the wrong cast.)
In the last six cases, this was a flat-out error --- possibly mine to
begin with, but it was a long time ago.

The security label for a procedural language was likewise not correctly
labeled as to schema, and both the comment and security label for a
procedural language were not correctly labeled as to owner.

In simple cases the restore would accidentally work correctly anyway, since
these comments and security labels would normally get emitted right after
the owning object, and so the search path and active user would be correct
anyhow.  But it could fail in corner cases; for example a schema-selective
restore would omit comments it should include.

Giuseppe Broccolo noted the oversight, and proposed the correct fix, for
text search dictionary objects; I found the rest by cross-checking other
dumpComment() calls.  These oversights are ancient, so back-patch all
the way.

Discussion: 
https://postgr.es/m/cafzmhiwwwzljzwm4x5ki5s_pdmr6nrkipzkjnno3b0xepbg...@mail.gmail.com

Branch
--
REL9_4_STABLE

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

Modified Files
--
src/bin/pg_dump/pg_dump.c | 18 +-
1 file changed, 9 insertions(+), 9 deletions(-)


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


[COMMITTERS] pgsql: Make simplehash.h grow hashtable in additional cases.

2017-03-06 Thread Andres Freund
Make simplehash.h grow hashtable in additional cases.

Increase the size when either the distance between actual and optimal
slot grows too large, or when too many subsequent entries would have
to be moved.

This addresses reports that the simplehash performed, sometimes
considerably, worse than dynahash.

The reason turned out to be that insertions into the hashtable where,
due to the use of parallel query, in effect done from another
hashtable, in hash-value order.  If the target hashtable, due to
mis-estimation, was sized a lot smaller than the source table(s) that
lead to very imbalanced tables; a lot of entries in many close-by
buckets from the source tables were inserted into a single, wider,
bucket on the target table.  As the growth factor was solely computed
based on the fillfactor, the performance of the table decreased
further and further.

b81b5a96f424531b was an attempt to address this problem for hash
aggregates (but not for bitmap scans), but it turns out that the
current method of mixing hash values often actually leaves neighboring
hash-values close to each other, just in different value range.  It
might be worth revisiting that independently of the performance issues
addressed in this patch..

To address that problem resize tables in two additional cases: Firstly
when the optimal position for an entry would be far from the actual
position, secondly when many entries would have to be moved to make
space for the new entry (while satisfying the robin hood property).

Due to the additional resizing threshold it seems possible, and
testing confirms that so far, that a higher fillfactor doesn't hurt
performance and saves a bit of memory.  It seems better to increase it
now, before a release containing any of this code, rather than wonder
in some later release.

The various boundaries aren't determined in a particularly scientific
manner, they might need some fine-tuning.

In all my tests the new code now, even with parallelism, performs at
least as good as the old code, in several scenarios significantly
better.

Reported-By: Dilip Kumar, Robert Haas, Kuntal Ghosh
Discussion:

https://postgr.es/m/CAFiTN-vagvuAydKG9VnWcoK=adahxmoa4ztrmnsvibbootn...@mail.gmail.com

https://postgr.es/m/CAGz5QC+=fntygzmltbunekt6uawzfxjbkb5+7owm-n9dwvx...@mail.gmail.com

Branch
--
master

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

Modified Files
--
src/include/lib/simplehash.h | 55 
1 file changed, 50 insertions(+), 5 deletions(-)


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


[COMMITTERS] pgsql: pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

2017-03-06 Thread Stephen Frost
pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

When performing a pg_upgrade, we copy the files behind pg_largeobject
and pg_largeobject_metadata, allowing us to avoid having to dump out and
reload the actual data for large objects and their ACLs.

Unfortunately, that isn't all of the information which can be associated
with large objects.  Currently, we also support COMMENTs and SECURITY
LABELs with large objects and these were being silently dropped during a
pg_upgrade as pg_dump would skip everything having to do with a large
object and pg_upgrade only copied the tables mentioned to the new
cluster.

As the file copies happen after the catalog dump and reload, we can't
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
output but we also have to include the actual large object definition as
well.  With the definition, comments, and security labels in the pg_dump
output and the file copies performed by pg_upgrade, all of the data and
metadata associated with large objects is able to be successfully pulled
forward across a pg_upgrade.

In 9.6 and master, we can simply adjust the dump bitmask to indicate
which components we don't want.  In 9.5 and earlier, we have to put
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
or the data when in binary-upgrade mode.

Adjustments made to the privileges regression test to allow another test
(large_object.sql) to be added which explicitly leaves a large object
with a comment in place to provide coverage of that case with
pg_upgrade.

Back-patch to all supported branches.

Discussion: https://postgr.es/m/20170221162655.ge9...@tamriel.snowman.net

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/6be8647f7862dbbefe4d49d842566738cd753963

Modified Files
--
src/bin/pg_dump/pg_backup.h|  1 +
src/bin/pg_dump/pg_backup_archiver.c   | 12 ++-
src/bin/pg_dump/pg_dump.c  | 34 +-
src/test/regress/expected/large_object.out | 15 +
src/test/regress/expected/privileges.out   |  8 +++
src/test/regress/parallel_schedule |  2 +-
src/test/regress/serial_schedule   |  1 +
src/test/regress/sql/large_object.sql  |  7 ++
src/test/regress/sql/privileges.sql|  6 +++---
9 files changed, 72 insertions(+), 14 deletions(-)


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


[COMMITTERS] pgsql: pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

2017-03-06 Thread Stephen Frost
pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

When performing a pg_upgrade, we copy the files behind pg_largeobject
and pg_largeobject_metadata, allowing us to avoid having to dump out and
reload the actual data for large objects and their ACLs.

Unfortunately, that isn't all of the information which can be associated
with large objects.  Currently, we also support COMMENTs and SECURITY
LABELs with large objects and these were being silently dropped during a
pg_upgrade as pg_dump would skip everything having to do with a large
object and pg_upgrade only copied the tables mentioned to the new
cluster.

As the file copies happen after the catalog dump and reload, we can't
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
output but we also have to include the actual large object definition as
well.  With the definition, comments, and security labels in the pg_dump
output and the file copies performed by pg_upgrade, all of the data and
metadata associated with large objects is able to be successfully pulled
forward across a pg_upgrade.

In 9.6 and master, we can simply adjust the dump bitmask to indicate
which components we don't want.  In 9.5 and earlier, we have to put
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
or the data when in binary-upgrade mode.

Adjustments made to the privileges regression test to allow another test
(large_object.sql) to be added which explicitly leaves a large object
with a comment in place to provide coverage of that case with
pg_upgrade.

Back-patch to all supported branches.

Discussion: https://postgr.es/m/20170221162655.ge9...@tamriel.snowman.net

Branch
--
REL9_4_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/93598898c8d203ef296f4f5870c5f948e9fda416

Modified Files
--
src/bin/pg_dump/pg_backup.h|  1 +
src/bin/pg_dump/pg_backup_archiver.c   | 12 ++-
src/bin/pg_dump/pg_dump.c  | 34 +-
src/test/regress/expected/large_object.out | 15 +
src/test/regress/expected/privileges.out   |  8 +++
src/test/regress/parallel_schedule |  2 +-
src/test/regress/serial_schedule   |  1 +
src/test/regress/sql/large_object.sql  |  7 ++
src/test/regress/sql/privileges.sql|  6 +++---
9 files changed, 72 insertions(+), 14 deletions(-)


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


[COMMITTERS] pgsql: pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

2017-03-06 Thread Stephen Frost
pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

When performing a pg_upgrade, we copy the files behind pg_largeobject
and pg_largeobject_metadata, allowing us to avoid having to dump out and
reload the actual data for large objects and their ACLs.

Unfortunately, that isn't all of the information which can be associated
with large objects.  Currently, we also support COMMENTs and SECURITY
LABELs with large objects and these were being silently dropped during a
pg_upgrade as pg_dump would skip everything having to do with a large
object and pg_upgrade only copied the tables mentioned to the new
cluster.

As the file copies happen after the catalog dump and reload, we can't
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
output but we also have to include the actual large object definition as
well.  With the definition, comments, and security labels in the pg_dump
output and the file copies performed by pg_upgrade, all of the data and
metadata associated with large objects is able to be successfully pulled
forward across a pg_upgrade.

In 9.6 and master, we can simply adjust the dump bitmask to indicate
which components we don't want.  In 9.5 and earlier, we have to put
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
or the data when in binary-upgrade mode.

Adjustments made to the privileges regression test to allow another test
(large_object.sql) to be added which explicitly leaves a large object
with a comment in place to provide coverage of that case with
pg_upgrade.

Back-patch to all supported branches.

Discussion: https://postgr.es/m/20170221162655.ge9...@tamriel.snowman.net

Branch
--
REL9_2_STABLE

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

Modified Files
--
src/bin/pg_dump/pg_backup.h|  1 +
src/bin/pg_dump/pg_backup_archiver.c   | 12 ++-
src/bin/pg_dump/pg_dump.c  | 34 +-
src/test/regress/expected/large_object.out | 15 +
src/test/regress/expected/privileges.out   |  8 +++
src/test/regress/parallel_schedule |  2 +-
src/test/regress/serial_schedule   |  1 +
src/test/regress/sql/large_object.sql  |  7 ++
src/test/regress/sql/privileges.sql|  6 +++---
9 files changed, 72 insertions(+), 14 deletions(-)


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


[COMMITTERS] pgsql: pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

2017-03-06 Thread Stephen Frost
pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

When performing a pg_upgrade, we copy the files behind pg_largeobject
and pg_largeobject_metadata, allowing us to avoid having to dump out and
reload the actual data for large objects and their ACLs.

Unfortunately, that isn't all of the information which can be associated
with large objects.  Currently, we also support COMMENTs and SECURITY
LABELs with large objects and these were being silently dropped during a
pg_upgrade as pg_dump would skip everything having to do with a large
object and pg_upgrade only copied the tables mentioned to the new
cluster.

As the file copies happen after the catalog dump and reload, we can't
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
output but we also have to include the actual large object definition as
well.  With the definition, comments, and security labels in the pg_dump
output and the file copies performed by pg_upgrade, all of the data and
metadata associated with large objects is able to be successfully pulled
forward across a pg_upgrade.

In 9.6 and master, we can simply adjust the dump bitmask to indicate
which components we don't want.  In 9.5 and earlier, we have to put
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
or the data when in binary-upgrade mode.

Adjustments made to the privileges regression test to allow another test
(large_object.sql) to be added which explicitly leaves a large object
with a comment in place to provide coverage of that case with
pg_upgrade.

Back-patch to all supported branches.

Discussion: https://postgr.es/m/20170221162655.ge9...@tamriel.snowman.net

Branch
--
REL9_6_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/65a3f233b2cf9aa7750d0c634654a65f4c5579c4

Modified Files
--
src/bin/pg_dump/pg_backup.h|  1 +
src/bin/pg_dump/pg_backup_archiver.c   | 12 +++-
src/bin/pg_dump/pg_dump.c  | 31 +++---
src/test/regress/expected/large_object.out | 15 +++
src/test/regress/expected/privileges.out   |  8 
src/test/regress/parallel_schedule |  2 +-
src/test/regress/serial_schedule   |  1 +
src/test/regress/sql/large_object.sql  |  8 
src/test/regress/sql/privileges.sql|  6 +++---
9 files changed, 72 insertions(+), 12 deletions(-)


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


[COMMITTERS] pgsql: pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

2017-03-06 Thread Stephen Frost
pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

When performing a pg_upgrade, we copy the files behind pg_largeobject
and pg_largeobject_metadata, allowing us to avoid having to dump out and
reload the actual data for large objects and their ACLs.

Unfortunately, that isn't all of the information which can be associated
with large objects.  Currently, we also support COMMENTs and SECURITY
LABELs with large objects and these were being silently dropped during a
pg_upgrade as pg_dump would skip everything having to do with a large
object and pg_upgrade only copied the tables mentioned to the new
cluster.

As the file copies happen after the catalog dump and reload, we can't
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
output but we also have to include the actual large object definition as
well.  With the definition, comments, and security labels in the pg_dump
output and the file copies performed by pg_upgrade, all of the data and
metadata associated with large objects is able to be successfully pulled
forward across a pg_upgrade.

In 9.6 and master, we can simply adjust the dump bitmask to indicate
which components we don't want.  In 9.5 and earlier, we have to put
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
or the data when in binary-upgrade mode.

Adjustments made to the privileges regression test to allow another test
(large_object.sql) to be added which explicitly leaves a large object
with a comment in place to provide coverage of that case with
pg_upgrade.

Back-patch to all supported branches.

Discussion: https://postgr.es/m/20170221162655.ge9...@tamriel.snowman.net

Branch
--
REL9_3_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/7f831f09bb85d93d99f55269479e4b6d105937f8

Modified Files
--
src/bin/pg_dump/pg_backup.h|  1 +
src/bin/pg_dump/pg_backup_archiver.c   | 12 ++-
src/bin/pg_dump/pg_dump.c  | 34 +-
src/test/regress/expected/large_object.out | 15 +
src/test/regress/expected/privileges.out   |  8 +++
src/test/regress/parallel_schedule |  2 +-
src/test/regress/serial_schedule   |  1 +
src/test/regress/sql/large_object.sql  |  7 ++
src/test/regress/sql/privileges.sql|  6 +++---
9 files changed, 72 insertions(+), 14 deletions(-)


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


[COMMITTERS] pgsql: pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

2017-03-06 Thread Stephen Frost
pg_upgrade: Fix large object COMMENTS, SECURITY LABELS

When performing a pg_upgrade, we copy the files behind pg_largeobject
and pg_largeobject_metadata, allowing us to avoid having to dump out and
reload the actual data for large objects and their ACLs.

Unfortunately, that isn't all of the information which can be associated
with large objects.  Currently, we also support COMMENTs and SECURITY
LABELs with large objects and these were being silently dropped during a
pg_upgrade as pg_dump would skip everything having to do with a large
object and pg_upgrade only copied the tables mentioned to the new
cluster.

As the file copies happen after the catalog dump and reload, we can't
simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
output but we also have to include the actual large object definition as
well.  With the definition, comments, and security labels in the pg_dump
output and the file copies performed by pg_upgrade, all of the data and
metadata associated with large objects is able to be successfully pulled
forward across a pg_upgrade.

In 9.6 and master, we can simply adjust the dump bitmask to indicate
which components we don't want.  In 9.5 and earlier, we have to put
explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
or the data when in binary-upgrade mode.

Adjustments made to the privileges regression test to allow another test
(large_object.sql) to be added which explicitly leaves a large object
with a comment in place to provide coverage of that case with
pg_upgrade.

Back-patch to all supported branches.

Discussion: https://postgr.es/m/20170221162655.ge9...@tamriel.snowman.net

Branch
--
master

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

Modified Files
--
src/bin/pg_dump/pg_backup.h|  1 +
src/bin/pg_dump/pg_backup_archiver.c   | 10 +-
src/bin/pg_dump/pg_dump.c  | 31 +++---
src/bin/pg_dump/t/002_pg_dump.pl   | 14 ++
src/test/regress/expected/large_object.out | 15 +++
src/test/regress/expected/privileges.out   |  8 
src/test/regress/parallel_schedule |  2 +-
src/test/regress/serial_schedule   |  1 +
src/test/regress/sql/large_object.sql  |  8 
src/test/regress/sql/privileges.sql|  6 +++---
10 files changed, 80 insertions(+), 16 deletions(-)


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


Re: [COMMITTERS] pgsql: Mark pg_start_backup and pg_stop_backup as parallel-restricted.

2017-03-06 Thread Robert Haas
On Mon, Mar 6, 2017 at 3:23 PM, Tom Lane  wrote:
> Yes, I think it's rather silly not to do so.  We have made comparable
> backpatched fixes multiple times in the past.  What is worth discussing is
> whether there are *additional* things we ought to do in 9.6 to prevent
> misbehavior in installations initdb'd pre-9.6.3.
>
> If there's a cheap way of testing "AmInParallelWorker", I'd be in favor of
> adding a quick-n-dirty test and ereport(ERROR) to these functions in the
> 9.6 branch, so that at least you get a clean error and not some weird
> misbehavior.  Not sure if there's anything more we can do than that.

Sounds like you want IsParallelWorker().

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


[COMMITTERS] pgsql: Avoid dangling pointer to relation name in RLS code path in DoCo

2017-03-06 Thread Tom Lane
Avoid dangling pointer to relation name in RLS code path in DoCopy().

With RLS active, "COPY tab TO ..." failed under -DRELCACHE_FORCE_RELEASE,
and would sometimes fail without that, because it used the relation name
directly from the relcache as part of the parsetree it's building.  That
becomes a potentially-dangling pointer as soon as the relcache entry is
closed, a bit further down.  Typical symptom if the relcache entry chanced
to get cleared would be "relation does not exist" error with a garbage
relation name, or possibly a core dump; but if you were really truly
unlucky, the COPY might copy from the wrong table.

Per report from Andrew Dunstan that regression tests fail with
-DRELCACHE_FORCE_RELEASE.  The core tests now pass for me (but have
not tried "make check-world" yet).

Discussion: 
https://postgr.es/m/7b52f900-0579-cda9-ae2e-de5da1709...@2ndquadrant.com

Branch
--
REL9_5_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/420d9ec0aebb0cd8d3198d25d6acaf07b0a576b9

Modified Files
--
src/backend/commands/copy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


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


[COMMITTERS] pgsql: Avoid dangling pointer to relation name in RLS code path in DoCo

2017-03-06 Thread Tom Lane
Avoid dangling pointer to relation name in RLS code path in DoCopy().

With RLS active, "COPY tab TO ..." failed under -DRELCACHE_FORCE_RELEASE,
and would sometimes fail without that, because it used the relation name
directly from the relcache as part of the parsetree it's building.  That
becomes a potentially-dangling pointer as soon as the relcache entry is
closed, a bit further down.  Typical symptom if the relcache entry chanced
to get cleared would be "relation does not exist" error with a garbage
relation name, or possibly a core dump; but if you were really truly
unlucky, the COPY might copy from the wrong table.

Per report from Andrew Dunstan that regression tests fail with
-DRELCACHE_FORCE_RELEASE.  The core tests now pass for me (but have
not tried "make check-world" yet).

Discussion: 
https://postgr.es/m/7b52f900-0579-cda9-ae2e-de5da1709...@2ndquadrant.com

Branch
--
master

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

Modified Files
--
src/backend/commands/copy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


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


[COMMITTERS] pgsql: Avoid dangling pointer to relation name in RLS code path in DoCo

2017-03-06 Thread Tom Lane
Avoid dangling pointer to relation name in RLS code path in DoCopy().

With RLS active, "COPY tab TO ..." failed under -DRELCACHE_FORCE_RELEASE,
and would sometimes fail without that, because it used the relation name
directly from the relcache as part of the parsetree it's building.  That
becomes a potentially-dangling pointer as soon as the relcache entry is
closed, a bit further down.  Typical symptom if the relcache entry chanced
to get cleared would be "relation does not exist" error with a garbage
relation name, or possibly a core dump; but if you were really truly
unlucky, the COPY might copy from the wrong table.

Per report from Andrew Dunstan that regression tests fail with
-DRELCACHE_FORCE_RELEASE.  The core tests now pass for me (but have
not tried "make check-world" yet).

Discussion: 
https://postgr.es/m/7b52f900-0579-cda9-ae2e-de5da1709...@2ndquadrant.com

Branch
--
REL9_6_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/943140d572adc94b957d123aa4c35ec88e40e869

Modified Files
--
src/backend/commands/copy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)


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


Re: [COMMITTERS] pgsql: Mark pg_start_backup and pg_stop_backup as parallel-restricted.

2017-03-06 Thread Stephen Frost
Tom,

* Tom Lane (t...@sss.pgh.pa.us) wrote:
> David Steele  writes:
> > On 3/6/17 12:48 PM, Robert Haas wrote:
> >> This issue also exists in 9.6, but we obviously can't do anything
> >> about 9.6 clusters that already exist.  Possibly this could be
> >> back-patched so that future 9.6 clusters would come out OK, or
> >> possibly we should back-patch some other fix, but that would need more
> >> discussion.
> 
> > I think it would be worth back-patching the catalog fix for future 9.6 
> > clusters as a start.
> 
> Yes, I think it's rather silly not to do so.  We have made comparable
> backpatched fixes multiple times in the past.  What is worth discussing is
> whether there are *additional* things we ought to do in 9.6 to prevent
> misbehavior in installations initdb'd pre-9.6.3.
> 
> If there's a cheap way of testing "AmInParallelWorker", I'd be in favor of
> adding a quick-n-dirty test and ereport(ERROR) to these functions in the
> 9.6 branch, so that at least you get a clean error and not some weird
> misbehavior.  Not sure if there's anything more we can do than that.

That's more-or-less what I was thinking (and suggested to David over IM
a little while ago, actually).  I don't know if there's an easy way to
do such a check, but I don't think it would really need to be
particularly cheap, just not overly complex.  These code paths are
certainly not ones that need to be high-performance.

Thanks!

Stephen


signature.asc
Description: Digital signature


Re: [COMMITTERS] pgsql: Mark pg_start_backup and pg_stop_backup as parallel-restricted.

2017-03-06 Thread Tom Lane
David Steele  writes:
> On 3/6/17 12:48 PM, Robert Haas wrote:
>> This issue also exists in 9.6, but we obviously can't do anything
>> about 9.6 clusters that already exist.  Possibly this could be
>> back-patched so that future 9.6 clusters would come out OK, or
>> possibly we should back-patch some other fix, but that would need more
>> discussion.

> I think it would be worth back-patching the catalog fix for future 9.6 
> clusters as a start.

Yes, I think it's rather silly not to do so.  We have made comparable
backpatched fixes multiple times in the past.  What is worth discussing is
whether there are *additional* things we ought to do in 9.6 to prevent
misbehavior in installations initdb'd pre-9.6.3.

If there's a cheap way of testing "AmInParallelWorker", I'd be in favor of
adding a quick-n-dirty test and ereport(ERROR) to these functions in the
9.6 branch, so that at least you get a clean error and not some weird
misbehavior.  Not sure if there's anything more we can do than that.

regards, tom lane


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


Re: [COMMITTERS] pgsql: Mark pg_start_backup and pg_stop_backup as parallel-restricted.

2017-03-06 Thread David Steele

On 3/6/17 12:48 PM, Robert Haas wrote:

Mark pg_start_backup and pg_stop_backup as parallel-restricted.

They depend on backend-private state that will not be synchronized by
the parallel machinery, so they should not be marked parallel-safe.
This issue also exists in 9.6, but we obviously can't do anything
about 9.6 clusters that already exist.  Possibly this could be
back-patched so that future 9.6 clusters would come out OK, or
possibly we should back-patch some other fix, but that would need more
discussion.


I think it would be worth back-patching the catalog fix for future 9.6 
clusters as a start.  Parallelism is off by default in 9.6 so that 
mitigates some of the problem.


I don't have any regression tests that cover backups when parallelism is 
enabled in 9.6, but I'm willing to do that and see if this is a 
realistic issue or not.


--
-David
da...@pgmasters.net


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


Re: [COMMITTERS] pgsql: Notify bgworker registrant after freeing worker slot.

2017-03-06 Thread Tom Lane
Robert Haas  writes:
> On Mon, Mar 6, 2017 at 8:21 AM, Amit Kapila  wrote:
>> On Fri, Mar 3, 2017 at 9:27 AM, Robert Haas  wrote:
>>> Notify bgworker registrant after freeing worker slot.

>> After this commit, I am seeing parallel queires being stucked on my
>> windows machine.  I think the notify pid is stale in
>> ReportBackgroundWorkerExit() as we are freeing the same in
>> ForgetBackgroundWorker().  Attached patch fixes the problem for me.
>> Ashutosh Sharma has independently reported (offlist) this problem to me.

> Thanks for the report and patch.  Committed.

Hmm, maybe this also explains skink's recent failure in the
select_parallel test.  I was going to go try to duplicate that, but
now maybe I'll just wait to see if its next run is green.

regards, tom lane


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


[COMMITTERS] pgsql: Allow dropping multiple functions at once

2017-03-06 Thread Peter Eisentraut
Allow dropping multiple functions at once

The generic drop support already supported dropping multiple objects of
the same kind at once.  But the previous representation
of function signatures across two grammar symbols and structure members
made this cumbersome to do for functions, so it was not supported.  Now
that function signatures are represented by a single structure, it's
trivial to add this support.  Same for aggregates and operators.

Reviewed-by: Jim Nasby 
Reviewed-by: Michael Paquier 

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/583f6c414895e72c710f723fbb3649df664530d7

Modified Files
--
doc/src/sgml/ref/drop_aggregate.sgml| 11 +--
doc/src/sgml/ref/drop_function.sgml |  8 +-
doc/src/sgml/ref/drop_operator.sgml |  8 +-
src/backend/parser/gram.y   | 38 -
src/test/regress/expected/create_function_3.out |  6 ++--
src/test/regress/sql/create_function_3.sql  |  2 ++
6 files changed, 52 insertions(+), 21 deletions(-)


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


[COMMITTERS] pgsql: Replace LookupFuncNameTypeNames() with LookupFuncWithArgs()

2017-03-06 Thread Peter Eisentraut
Replace LookupFuncNameTypeNames() with LookupFuncWithArgs()

The old function took function name and function argument list as
separate arguments.  Now that all function signatures are passed around
as ObjectWithArgs structs, this is no longer necessary and can be
replaced by a function that takes ObjectWithArgs directly.  Similarly
for aggregates and operators.

Reviewed-by: Jim Nasby 
Reviewed-by: Michael Paquier 

Branch
--
master

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

Modified Files
--
src/backend/catalog/aclchk.c|  3 +--
src/backend/catalog/objectaddress.c | 40 +++--
src/backend/commands/functioncmds.c | 12 ---
src/backend/commands/opclasscmds.c  | 30 +++-
src/backend/commands/operatorcmds.c |  5 +
src/backend/nodes/copyfuncs.c   |  2 --
src/backend/nodes/equalfuncs.c  |  2 --
src/backend/parser/gram.y   | 18 -
src/backend/parser/parse_func.c | 32 ++---
src/backend/parser/parse_oper.c | 24 --
src/include/nodes/parsenodes.h  |  7 ++-
src/include/parser/parse_func.h |  4 ++--
src/include/parser/parse_oper.h |  5 ++---
13 files changed, 68 insertions(+), 116 deletions(-)


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


[COMMITTERS] pgsql: Add operator_with_argtypes grammar rule

2017-03-06 Thread Peter Eisentraut
Add operator_with_argtypes grammar rule

This makes the handling of operators similar to that of functions and
aggregates.

Rename node FuncWithArgs to ObjectWithArgs, to reflect the expanded use.

Reviewed-by: Jim Nasby 
Reviewed-by: Michael Paquier 

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/550214a4efb214dfc9c2a475607da69da858

Modified Files
--
src/backend/catalog/aclchk.c|   6 +-
src/backend/commands/functioncmds.c |  24 +++---
src/backend/nodes/copyfuncs.c   |  14 +--
src/backend/nodes/equalfuncs.c  |  10 +--
src/backend/parser/gram.y   | 164 +++-
src/include/nodes/nodes.h   |   2 +-
src/include/nodes/parsenodes.h  |  20 ++---
src/tools/pgindent/typedefs.list|   2 +-
8 files changed, 126 insertions(+), 116 deletions(-)


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


[COMMITTERS] pgsql: Remove objname/objargs split for referring to objects

2017-03-06 Thread Peter Eisentraut
Remove objname/objargs split for referring to objects

In simpler times, it might have worked to refer to all kinds of objects
by a list of name components and an optional argument list.  But this
doesn't work for all objects, which has resulted in a collection of
hacks to place various other nodes types into these fields, which have
to be unpacked at the other end.  This makes it also weird to represent
lists of such things in the grammar, because they would have to be lists
of singleton lists, to make the unpacking work consistently.  The other
problem is that keeping separate name and args fields makes it awkward
to deal with lists of functions.

Change that by dropping the objargs field and have objname, renamed to
object, be a generic Node, which can then be flexibly assigned and
managed using the normal Node mechanisms.  In many cases it will still
be a List of names, in some cases it will be a string Value, for types
it will be the existing Typename, for functions it will now use the
existing ObjectWithArgs node type.  Some of the more obscure object
types still use somewhat arbitrary nested lists.

Reviewed-by: Jim Nasby 
Reviewed-by: Michael Paquier 

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/8b6d6cf853aab12f0dc2adba7c99c3e458662734

Modified Files
--
src/backend/catalog/objectaddress.c  | 447 +++
src/backend/commands/alter.c |  33 +-
src/backend/commands/comment.c   |  11 +-
src/backend/commands/dropcmds.c  | 175 +--
src/backend/commands/extension.c |  13 +-
src/backend/commands/seclabel.c  |   4 +-
src/backend/commands/tablecmds.c |  10 +-
src/backend/commands/typecmds.c  |   2 +-
src/backend/nodes/copyfuncs.c|  16 +-
src/backend/nodes/equalfuncs.c   |  16 +-
src/backend/parser/gram.y| 440 --
src/backend/parser/parse_utilcmd.c   |  14 +-
src/include/catalog/objectaddress.h  |   8 +-
src/include/commands/extension.h |   2 +-
src/include/nodes/parsenodes.h   |  24 +-
src/test/regress/expected/event_trigger.out  |   3 -
src/test/regress/expected/object_address.out |  24 +-
src/test/regress/sql/event_trigger.sql   |   3 -
18 files changed, 610 insertions(+), 635 deletions(-)


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


[COMMITTERS] pgsql: Combine several DROP variants into generic DropStmt

2017-03-06 Thread Peter Eisentraut
Combine several DROP variants into generic DropStmt

Combine DROP of FOREIGN DATA WRAPPER, SERVER, POLICY, RULE, and TRIGGER
into generic DropStmt grammar.

Reviewed-by: Jim Nasby 
Reviewed-by: Michael Paquier 

Branch
--
master

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

Modified Files
--
doc/src/sgml/ref/drop_foreign_data_wrapper.sgml |   2 +-
doc/src/sgml/ref/drop_server.sgml   |   2 +-
src/backend/parser/gram.y   | 173 +---
3 files changed, 35 insertions(+), 142 deletions(-)


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


[COMMITTERS] pgsql: Use class_args field in opclass_drop

2017-03-06 Thread Peter Eisentraut
Use class_args field in opclass_drop

This makes it consistent with the usage in opclass_item.

Reviewed-by: Jim Nasby 
Reviewed-by: Michael Paquier 

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/63ebd377a6ecd3388596c3ea958e813f23b5f4ae

Modified Files
--
src/backend/commands/opclasscmds.c | 4 ++--
src/backend/parser/gram.y  | 4 ++--
src/include/nodes/parsenodes.h | 3 ++-
3 files changed, 6 insertions(+), 5 deletions(-)


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


[COMMITTERS] pgsql: Fix incorrect comments.

2017-03-06 Thread Robert Haas
Fix incorrect comments.

Commit 19dc233c32f2900e57b8da4f41c0f662ab42e080 introduced these
comments.  Michael Paquier noticed that one of them had a typo, but
a bigger problem is that they were not an accurate description of
what the code was doing.

Patch by me.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/12a2544cb5f9e1f8541d1b941da6d9dae15f50a5

Modified Files
--
src/backend/utils/adt/misc.c | 10 ++
1 file changed, 2 insertions(+), 8 deletions(-)


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


[COMMITTERS] pgsql: Mark pg_start_backup and pg_stop_backup as parallel-restricted.

2017-03-06 Thread Robert Haas
Mark pg_start_backup and pg_stop_backup as parallel-restricted.

They depend on backend-private state that will not be synchronized by
the parallel machinery, so they should not be marked parallel-safe.
This issue also exists in 9.6, but we obviously can't do anything
about 9.6 clusters that already exist.  Possibly this could be
back-patched so that future 9.6 clusters would come out OK, or
possibly we should back-patch some other fix, but that would need more
discussion.

David Steele, reviewed by Michael Paquier

Discussion: 
http://postgr.es/m/CA+TgmoYCWfO2UM-t=humfjyxjywldill0najpx88lktvbvn...@mail.gmail.com

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/9fe3c644a73198941e9a502958c24727dc4a6434

Modified Files
--
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h| 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)


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


Re: [COMMITTERS] pgsql: Notify bgworker registrant after freeing worker slot.

2017-03-06 Thread Robert Haas
On Mon, Mar 6, 2017 at 8:21 AM, Amit Kapila  wrote:
> On Fri, Mar 3, 2017 at 9:27 AM, Robert Haas  wrote:
>> Notify bgworker registrant after freeing worker slot.
>
> After this commit, I am seeing parallel queires being stucked on my
> windows machine.  I think the notify pid is stale in
> ReportBackgroundWorkerExit() as we are freeing the same in
> ForgetBackgroundWorker().  Attached patch fixes the problem for me.
>
> Ashutosh Sharma has independently reported (offlist) this problem to me.

Thanks for the report and patch.  Committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


[COMMITTERS] pgsql: Fix user-after-free bug.

2017-03-06 Thread Robert Haas
Fix user-after-free bug.

Introduced by commit aea5d298362e881b13d95a48c5ae116879237389.

Patch from Amit Kapila.  Issue discovered independently by Amit Kapila
and Ashutosh Sharma.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/7f6fa29f18aa84743185ee7ada97f277459228a7

Modified Files
--
src/backend/postmaster/bgworker.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)


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


[COMMITTERS] pgsql: Reorder the asynchronous libpq calls for replication connection

2017-03-06 Thread Peter Eisentraut
Reorder the asynchronous libpq calls for replication connection

Per libpq documentation, the initial state must be
PGRES_POLLING_WRITING.  Failing to do that appears to cause some issues
on some Windows systems.

From: Petr Jelinek 

Branch
--
master

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

Modified Files
--
.../replication/libpqwalreceiver/libpqwalreceiver.c| 18 ++
1 file changed, 10 insertions(+), 8 deletions(-)


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


Re: [COMMITTERS] pgsql: Notify bgworker registrant after freeing worker slot.

2017-03-06 Thread Amit Kapila
On Fri, Mar 3, 2017 at 9:27 AM, Robert Haas  wrote:
> Notify bgworker registrant after freeing worker slot.
>

After this commit, I am seeing parallel queires being stucked on my
windows machine.  I think the notify pid is stale in
ReportBackgroundWorkerExit() as we are freeing the same in
ForgetBackgroundWorker().  Attached patch fixes the problem for me.

Ashutosh Sharma has independently reported (offlist) this problem to me.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


select_parallel_hang_v1.patch
Description: Binary data

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


Re: [COMMITTERS] pgsql: Allow vacuums to report oldestxmin

2017-03-06 Thread Masahiko Sawada
On Fri, Mar 3, 2017 at 10:50 PM, Simon Riggs  wrote:
> Allow vacuums to report oldestxmin
>
> Allow VACUUM and Autovacuum to report the oldestxmin value they
> used while cleaning tables, helping to make better sense out of
> the other statistics we report in various cases.
>
> Branch
> --
> master
>
> Details
> ---
> http://git.postgresql.org/pg/commitdiff/9eb344faf54a849898d9be012ddfa8204cfeb57c
>
> Modified Files
> --
> src/backend/commands/vacuumlazy.c | 9 +
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
>

Should we change the example in vacuum.sgml file as well? Attached patch.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


fix_vacuum_example_in_doc.patch
Description: Binary data

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


[COMMITTERS] pgsql: Enhance docs for ALTER TABLE lock levels of storage parms

2017-03-06 Thread Simon Riggs
Enhance docs for ALTER TABLE lock levels of storage parms

As requested by Robert Haas

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/6f3a13ff058f15d565a30c16c0c2cb14cc994e42

Modified Files
--
doc/src/sgml/ref/alter_table.sgml | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)


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


[COMMITTERS] pgsql: Reduce lock levels for table storage params related to planning

2017-03-06 Thread Simon Riggs
Reduce lock levels for table storage params related to planning

The following parameters are now updateable with ShareUpdateExclusiveLock
effective_io_concurrency
parallel_workers
seq_page_cost
random_page_cost
n_distinct
n_distinct_inherited

Simon Riggs and Fabrízio Mello

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/21d4e2e20656381b4652eb675af4f6d65053607f

Modified Files
--
src/backend/access/common/reloptions.c | 50 +-
src/backend/utils/cache/spccache.c | 11 
2 files changed, 54 insertions(+), 7 deletions(-)


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


[COMMITTERS] pgsql: Allow partitioned tables to be dropped without CASCADE

2017-03-06 Thread Simon Riggs
Allow partitioned tables to be dropped without CASCADE

Record partitioned table dependencies as DEPENDENCY_AUTO
rather than DEPENDENCY_NORMAL, so that DROP TABLE just works.

Remove all the tests for partitioned tables where earlier
work had deliberately avoided using CASCADE.

Amit Langote, reviewed by Ashutosh Bapat and myself

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/8b4d582d279d784616c228be58af1e39aa430402

Modified Files
--
src/backend/commands/tablecmds.c   | 30 ++
src/test/regress/expected/alter_table.out  | 10 --
src/test/regress/expected/create_table.out |  9 ++---
src/test/regress/expected/inherit.out  | 22 ++
src/test/regress/expected/insert.out   |  7 ++-
src/test/regress/expected/update.out   |  7 +--
src/test/regress/sql/alter_table.sql   | 10 --
src/test/regress/sql/create_table.sql  |  9 ++---
src/test/regress/sql/inherit.sql   |  4 ++--
src/test/regress/sql/insert.sql|  7 ++-
src/test/regress/sql/update.sql|  2 +-
11 files changed, 44 insertions(+), 73 deletions(-)


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