pgsql: pgbench: consolidate a few PQfinish calls.

2018-03-01 Thread Andres Freund
pgbench: consolidate a few PQfinish calls. Author: Doug Rady Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/337be37da34fd6ccfb63350c3d5b1b284fc58084 Modified Files -- src/b

pgsql: doc: Add random_zipfian to list of random functions with argumen

2018-03-01 Thread Andres Freund
doc: Add random_zipfian to list of random functions with argument. Author: Ildar Musin Reviewed-By: Fabian Coelho Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8c438fcc9f19273b884

pgsql: doc: Add WaitForBackgroundWorkerShutdown() to bgw docs.

2018-03-01 Thread Andres Freund
doc: Add WaitForBackgroundWorkerShutdown() to bgw docs. Commit 924bcf4f16d added WaitForBackgroundWorkerShutdown, but didn't add it to the documentation. Fix that and two small spelling errors in the WaitForBackgroundWorkerStartup paragraph. Author: Daniel Gustafsson Discussion: https://postgr.es

pgsql: doc: mention PROVE_TESTS in section of TAP tests.

2018-03-01 Thread Andres Freund
doc: mention PROVE_TESTS in section of TAP tests. Author: Michael Paquier Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/9c4968469abe01a030307f49837fa2cf51fcdb4b Modified Files -- doc/s

pgsql: pg_regress: Increase space available for test names.

2018-03-01 Thread Andres Freund
pg_regress: Increase space available for test names. A few isolationtester tests with reasonable names are too wide to nicely align. Increase space. Author: Thomas Munro Discussion: https://postgr.es/m/CAEepm=2v7+EHs6zsJzFn+zJOT4F4Kb69Z1xJ7Zf5kgwLr1n=v...@mail.gmail.com Branch -- master De

pgsql: Avoid using unsafe search_path settings during dump and restore.

2018-03-01 Thread Tom Lane
Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in sch

pgsql: Avoid using unsafe search_path settings during dump and restore.

2018-03-01 Thread Tom Lane
Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in sch

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

2018-03-01 Thread Noah Misch
Empty search_path in Autovacuum and non-psql/pgbench clients. This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain o

pgsql: Back-patch non-static ExecuteSqlQueryForSingleRow().

2018-03-01 Thread Noah Misch
Back-patch non-static ExecuteSqlQueryForSingleRow(). Back-patch a subset of commit 47e59697679a0877e0525c565b1be437487604a7 to 9.4 and 9.3. The next commit adds calls to this function. Security: CVE-2018-1058 Branch -- REL9_3_STABLE Details --- https://git.postgresql.org/pg/commitdiff/

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

2018-03-01 Thread Noah Misch
Empty search_path in Autovacuum and non-psql/pgbench clients. This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain o

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

2018-03-01 Thread Noah Misch
Empty search_path in Autovacuum and non-psql/pgbench clients. This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain o

pgsql: Document security implications of search_path and the public sch

2018-03-01 Thread Noah Misch
Document security implications of search_path and the public schema. The ability to create like-named objects in different schemas opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. When you connect to a PostgreSQL server, you should remo

pgsql: Document security implications of search_path and the public sch

2018-03-01 Thread Noah Misch
Document security implications of search_path and the public schema. The ability to create like-named objects in different schemas opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. When you connect to a PostgreSQL server, you should remo

pgsql: Document security implications of search_path and the public sch

2018-03-01 Thread Noah Misch
Document security implications of search_path and the public schema. The ability to create like-named objects in different schemas opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. When you connect to a PostgreSQL server, you should remo

pgsql: Last-minute updates for release notes.

2018-03-01 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2018-1058 Branch -- REL9_3_STABLE Details --- https://git.postgresql.org/pg/commitdiff/6674761c88b48832a5336b33cf7e3e2de7b1a7d8 Modified Files -- doc/src/sgml/release-9.3.sgml | 76 +

pgsql: Last-minute updates for release notes.

2018-03-01 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2018-1058 Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/e7d89ef4b53d5b01504c3fd5873133e6e68637df Modified Files -- doc/src/sgml/release-10.sgml | 106

pgsql: Last-minute updates for release notes.

2018-03-01 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2018-1058 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8af3855699aa6fa97b7d0d39e0bc7d3279d3fe47 Modified Files -- doc/src/sgml/release-10.sgml | 106 -- doc/

pgsql: Last-minute updates for release notes.

2018-03-01 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2018-1058 Branch -- REL9_5_STABLE Details --- https://git.postgresql.org/pg/commitdiff/7e5903937085ff873ce8b00131e89ebe59959f18 Modified Files -- doc/src/sgml/release-9.3.sgml | 76 +

pgsql: Schema-qualify references in test_ddl_deparse test script.

2018-03-01 Thread Tom Lane
Schema-qualify references in test_ddl_deparse test script. This omission seems to be what is causing buildfarm failures on crake. Security: CVE-2018-1058 Branch -- REL9_6_STABLE Details --- https://git.postgresql.org/pg/commitdiff/3300e876cd45cf169d981fa53f9c9e8289ee3c82 Modified Files

pgsql: Schema-qualify references in test_ddl_deparse test script.

2018-03-01 Thread Tom Lane
Schema-qualify references in test_ddl_deparse test script. This omission seems to be what is causing buildfarm failures on crake. Security: CVE-2018-1058 Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/fdf521d697a37fbaa283e7b9de3ffc7f5029f544 Modified Files

pgsql: Last-minute updates for release notes.

2018-03-01 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2018-1058 Branch -- REL9_6_STABLE Details --- https://git.postgresql.org/pg/commitdiff/adb0718a7f5ff453a6f9b2d7ce30943dec336e8b Modified Files -- doc/src/sgml/release-9.3.sgml | 76 +

pgsql: Schema-qualify references in test_ddl_deparse test script.

2018-03-01 Thread Tom Lane
Schema-qualify references in test_ddl_deparse test script. This omission seems to be what is causing buildfarm failures on crake. Security: CVE-2018-1058 Branch -- REL9_5_STABLE Details --- https://git.postgresql.org/pg/commitdiff/046a4ce39c440403b0034f0df625c29d848bb697 Modified Files

pgsql: Schema-qualify references in test_ddl_deparse test script.

2018-03-01 Thread Tom Lane
Schema-qualify references in test_ddl_deparse test script. This omission seems to be what is causing buildfarm failures on crake. Security: CVE-2018-1058 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fb533e45f91796875939a63e7554efff0da3c8e5 Modified Files --

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

2018-03-01 Thread Noah Misch
Empty search_path in Autovacuum and non-psql/pgbench clients. This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain o

pgsql: Avoid using unsafe search_path settings during dump and restore.

2018-03-01 Thread Tom Lane
Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in sch

pgsql: Back-patch non-static ExecuteSqlQueryForSingleRow().

2018-03-01 Thread Noah Misch
Back-patch non-static ExecuteSqlQueryForSingleRow(). Back-patch a subset of commit 47e59697679a0877e0525c565b1be437487604a7 to 9.4 and 9.3. The next commit adds calls to this function. Security: CVE-2018-1058 Branch -- REL9_4_STABLE Details --- https://git.postgresql.org/pg/commitdiff/

pgsql: Avoid using unsafe search_path settings during dump and restore.

2018-03-01 Thread Tom Lane
Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in sch

pgsql: Avoid using unsafe search_path settings during dump and restore.

2018-03-01 Thread Tom Lane
Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in sch

pgsql: Document security implications of search_path and the public sch

2018-03-01 Thread Noah Misch
Document security implications of search_path and the public schema. The ability to create like-named objects in different schemas opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. When you connect to a PostgreSQL server, you should remo

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

2018-03-01 Thread Noah Misch
Empty search_path in Autovacuum and non-psql/pgbench clients. This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain o

pgsql: Last-minute updates for release notes.

2018-03-01 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2018-1058 Branch -- REL9_4_STABLE Details --- https://git.postgresql.org/pg/commitdiff/dfebb71692724081374a391b1a8549a467bc1d08 Modified Files -- doc/src/sgml/release-9.3.sgml | 76 +

pgsql: Avoid using unsafe search_path settings during dump and restore.

2018-03-01 Thread Tom Lane
Avoid using unsafe search_path settings during dump and restore. Historically, pg_dump has "set search_path = foo, pg_catalog" when dumping an object in schema "foo", and has also caused that setting to be used while restoring the object. This is problematic because functions and operators in sch

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

2018-03-01 Thread Noah Misch
Empty search_path in Autovacuum and non-psql/pgbench clients. This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain o

pgsql: Document security implications of search_path and the public sch

2018-03-01 Thread Noah Misch
Document security implications of search_path and the public schema. The ability to create like-named objects in different schemas opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. When you connect to a PostgreSQL server, you should remo

pgsql: Document security implications of search_path and the public sch

2018-03-01 Thread Noah Misch
Document security implications of search_path and the public schema. The ability to create like-named objects in different schemas opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. When you connect to a PostgreSQL server, you should remo

pgsql: Fix format_type() to restore its old behavior.

2018-03-01 Thread Tom Lane
Fix format_type() to restore its old behavior. Commit a26116c6c accidentally changed the behavior of the SQL format_type() function while refactoring. For the reasons explained in that function's comment, a NULL typemod argument should behave differently from a -1 argument. Since we've managed t

pgsql: Remove out-of-date comment about formrdesc().

2018-03-01 Thread Tom Lane
Remove out-of-date comment about formrdesc(). formrdesc's comment listed the specific catalogs it is called for, but the list was out of date. Rather than jumping back onto that maintenance treadmill, let's just remove the list. It tells the reader nothing that can't be learned quickly and more

pgsql: Fix build failure on MSVC.

2018-03-01 Thread Tom Lane
Fix build failure on MSVC. Commit 824cceded introduced use of pg_malloc and pg_realloc into specscanner.l, but it isn't working in 9.3 on MSVC. Evidently we added the infrastructure for that in 9.4. Since the chance of an actual OOM here is tiny, and the consequences would only be an isolation t

pgsql: Fix IOS planning when only some index columns can return an attr

2018-03-01 Thread Tom Lane
Fix IOS planning when only some index columns can return an attribute. Since 9.5, it's possible that some but not all columns of an index support returning the indexed value for index-only scans. If the same indexed column appears in index columns that behave both ways, check_index_only() suppose

pgsql: Fix IOS planning when only some index columns can return an attr

2018-03-01 Thread Tom Lane
Fix IOS planning when only some index columns can return an attribute. Since 9.5, it's possible that some but not all columns of an index support returning the indexed value for index-only scans. If the same indexed column appears in index columns that behave both ways, check_index_only() suppose

pgsql: Fix IOS planning when only some index columns can return an attr

2018-03-01 Thread Tom Lane
Fix IOS planning when only some index columns can return an attribute. Since 9.5, it's possible that some but not all columns of an index support returning the indexed value for index-only scans. If the same indexed column appears in index columns that behave both ways, check_index_only() suppose

pgsql: Fix IOS planning when only some index columns can return an attr

2018-03-01 Thread Tom Lane
Fix IOS planning when only some index columns can return an attribute. Since 9.5, it's possible that some but not all columns of an index support returning the indexed value for index-only scans. If the same indexed column appears in index columns that behave both ways, check_index_only() suppose

pgsql: Relax overly strict sanity check for upgraded ancient databases

2018-03-01 Thread Alvaro Herrera
Relax overly strict sanity check for upgraded ancient databases Commit 4800f16a7ad0 added some sanity checks to ensure we don't accidentally corrupt data, but in one of them we failed to consider the effects of a database upgraded from 9.2 or earlier, where a tuple exclusively locked prior to the

pgsql: Relax overly strict sanity check for upgraded ancient databases

2018-03-01 Thread Alvaro Herrera
Relax overly strict sanity check for upgraded ancient databases Commit 4800f16a7ad0 added some sanity checks to ensure we don't accidentally corrupt data, but in one of them we failed to consider the effects of a database upgraded from 9.2 or earlier, where a tuple exclusively locked prior to the

pgsql: Relax overly strict sanity check for upgraded ancient databases

2018-03-01 Thread Alvaro Herrera
Relax overly strict sanity check for upgraded ancient databases Commit 4800f16a7ad0 added some sanity checks to ensure we don't accidentally corrupt data, but in one of them we failed to consider the effects of a database upgraded from 9.2 or earlier, where a tuple exclusively locked prior to the

pgsql: Relax overly strict sanity check for upgraded ancient databases

2018-03-01 Thread Alvaro Herrera
Relax overly strict sanity check for upgraded ancient databases Commit 4800f16a7ad0 added some sanity checks to ensure we don't accidentally corrupt data, but in one of them we failed to consider the effects of a database upgraded from 9.2 or earlier, where a tuple exclusively locked prior to the

pgsql: Relax overly strict sanity check for upgraded ancient databases

2018-03-01 Thread Alvaro Herrera
Relax overly strict sanity check for upgraded ancient databases Commit 4800f16a7ad0 added some sanity checks to ensure we don't accidentally corrupt data, but in one of them we failed to consider the effects of a database upgraded from 9.2 or earlier, where a tuple exclusively locked prior to the

pgsql: Relax overly strict sanity check for upgraded ancient databases

2018-03-01 Thread Alvaro Herrera
Relax overly strict sanity check for upgraded ancient databases Commit 4800f16a7ad0 added some sanity checks to ensure we don't accidentally corrupt data, but in one of them we failed to consider the effects of a database upgraded from 9.2 or earlier, where a tuple exclusively locked prior to the

pgsql: Use ereport not elog for some corrupt-HOT-chain reports.

2018-03-01 Thread Tom Lane
Use ereport not elog for some corrupt-HOT-chain reports. These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck.

pgsql: Use ereport not elog for some corrupt-HOT-chain reports.

2018-03-01 Thread Tom Lane
Use ereport not elog for some corrupt-HOT-chain reports. These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck.

pgsql: Use ereport not elog for some corrupt-HOT-chain reports.

2018-03-01 Thread Tom Lane
Use ereport not elog for some corrupt-HOT-chain reports. These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck.

pgsql: Use ereport not elog for some corrupt-HOT-chain reports.

2018-03-01 Thread Tom Lane
Use ereport not elog for some corrupt-HOT-chain reports. These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck.

pgsql: Use ereport not elog for some corrupt-HOT-chain reports.

2018-03-01 Thread Tom Lane
Use ereport not elog for some corrupt-HOT-chain reports. These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck.

pgsql: Use ereport not elog for some corrupt-HOT-chain reports.

2018-03-01 Thread Tom Lane
Use ereport not elog for some corrupt-HOT-chain reports. These errors have been seen in the field in corrupted-data situations. It seems worthwhile to report them with ERRCODE_DATA_CORRUPTED, rather than the generic ERRCODE_INTERNAL_ERROR, for the benefit of log monitoring and tools like amcheck.

pgsql: Remove volatile qualifiers from shm_mq.c.

2018-03-01 Thread Andres Freund
Remove volatile qualifiers from shm_mq.c. Since commit 0709b7ee, spinlock primitives include a compiler barrier so it is no longer necessary to access either spinlocks or the memory they protect through pointer-to-volatile. Like earlier commits e93b6298, d53e3d5f, 430008b5, 8f6bb851, df4077cd. A

pgsql: Minor clean-up in dshash.{c,h}.

2018-03-01 Thread Andres Freund
Minor clean-up in dshash.{c,h}. For consistency with other code that deals in numbers of buckets, the macro BUCKETS_PER_PARTITION should produce a value of type size_t. Also, fix a mention of an obsolete proposed name for dshash.c that appeared in a comment. Author: Thomas Munro, based on an obse