Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0b5dfa6

Browse files
committed
Merge 9.6.3 changes from REL9_6_STABLE
2 parents 46eb83a + bfaba24 commit 0b5dfa6

File tree

130 files changed

+21514
-16479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+21514
-16479
lines changed

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for PostgreSQL 9.6.2.
3+
# Generated by GNU Autoconf 2.69 for PostgreSQL 9.6.3.
44
#
55
# Report bugs to <bugs@postgrespro.ru>.
66
#
@@ -583,8 +583,8 @@ MAKEFLAGS=
583583
# Identity of this package.
584584
PACKAGE_NAME='PostgreSQL'
585585
PACKAGE_TARNAME='postgrespro'
586-
PACKAGE_VERSION='9.6.2'
587-
PACKAGE_STRING='PostgreSQL 9.6.2'
586+
PACKAGE_VERSION='9.6.3'
587+
PACKAGE_STRING='PostgreSQL 9.6.3'
588588
PACKAGE_BUGREPORT='bugs@postgrespro.ru'
589589
PACKAGE_URL=''
590590

@@ -1404,7 +1404,7 @@ if test "$ac_init_help" = "long"; then
14041404
# Omit some internal or obsolete options to make the list less imposing.
14051405
# This message is too long to be a string in the A/UX 3.1 sh.
14061406
cat <<_ACEOF
1407-
\`configure' configures PostgreSQL 9.6.2 to adapt to many kinds of systems.
1407+
\`configure' configures PostgreSQL 9.6.3 to adapt to many kinds of systems.
14081408

14091409
Usage: $0 [OPTION]... [VAR=VALUE]...
14101410

@@ -1469,7 +1469,7 @@ fi
14691469

14701470
if test -n "$ac_init_help"; then
14711471
case $ac_init_help in
1472-
short | recursive ) echo "Configuration of PostgreSQL 9.6.2:";;
1472+
short | recursive ) echo "Configuration of PostgreSQL 9.6.3:";;
14731473
esac
14741474
cat <<\_ACEOF
14751475

@@ -1622,7 +1622,7 @@ fi
16221622
test -n "$ac_init_help" && exit $ac_status
16231623
if $ac_init_version; then
16241624
cat <<\_ACEOF
1625-
PostgreSQL configure 9.6.2
1625+
PostgreSQL configure 9.6.3
16261626
generated by GNU Autoconf 2.69
16271627

16281628
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2334,7 +2334,7 @@ cat >config.log <<_ACEOF
23342334
This file contains any messages produced by compilers while
23352335
running configure, to aid debugging if configure makes a mistake.
23362336

2337-
It was created by PostgreSQL $as_me 9.6.2, which was
2337+
It was created by PostgreSQL $as_me 9.6.3, which was
23382338
generated by GNU Autoconf 2.69. Invocation command line was
23392339

23402340
$ $0 $@
@@ -18580,7 +18580,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1858018580
# report actual input values of CONFIG_FILES etc. instead of their
1858118581
# values after options handling.
1858218582
ac_log="
18583-
This file was extended by PostgreSQL $as_me 9.6.2, which was
18583+
This file was extended by PostgreSQL $as_me 9.6.3, which was
1858418584
generated by GNU Autoconf 2.69. Invocation command line was
1858518585

1858618586
CONFIG_FILES = $CONFIG_FILES
@@ -18650,7 +18650,7 @@ _ACEOF
1865018650
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1865118651
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1865218652
ac_cs_version="\\
18653-
PostgreSQL config.status 9.6.2
18653+
PostgreSQL config.status 9.6.3
1865418654
configured by $0, generated by GNU Autoconf 2.69,
1865518655
with options \\"\$ac_cs_config\\"
1865618656

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dnl Read the Autoconf manual for details.
1717
dnl
1818
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
1919

20-
AC_INIT([PostgreSQL], [9.6.2], [bugs@postgrespro.ru],[postgrespro])
20+
AC_INIT([PostgreSQL], [9.6.3], [bugs@postgrespro.ru],[postgrespro])
2121
PACKAGE_TARNAME=postgrespro
2222

2323
m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,35 @@ SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) WHERE (t1.c1
15011501
| 21
15021502
(10 rows)
15031503

1504+
-- full outer join + WHERE clause with shippable extensions set
1505+
EXPLAIN (VERBOSE, COSTS OFF)
1506+
SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE postgres_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10;
1507+
QUERY PLAN
1508+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1509+
Limit
1510+
Output: t1.c1, t2.c2, t1.c3
1511+
-> Foreign Scan
1512+
Output: t1.c1, t2.c2, t1.c3
1513+
Relations: (public.ft1 t1) FULL JOIN (public.ft2 t2)
1514+
Remote SQL: SELECT r1."C 1", r1.c3, r2.c2 FROM ("S 1"."T 1" r1 FULL JOIN "S 1"."T 1" r2 ON (((r1."C 1" = r2."C 1")))) WHERE ((public.postgres_fdw_abs(r1."C 1") > 0))
1515+
(6 rows)
1516+
1517+
ALTER SERVER loopback OPTIONS (DROP extensions);
1518+
-- full outer join + WHERE clause with shippable extensions not set
1519+
EXPLAIN (VERBOSE, COSTS OFF)
1520+
SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE postgres_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10;
1521+
QUERY PLAN
1522+
-------------------------------------------------------------------------------------------------------------------------------
1523+
Limit
1524+
Output: t1.c1, t2.c2, t1.c3
1525+
-> Foreign Scan
1526+
Output: t1.c1, t2.c2, t1.c3
1527+
Filter: (postgres_fdw_abs(t1.c1) > 0)
1528+
Relations: (public.ft1 t1) FULL JOIN (public.ft2 t2)
1529+
Remote SQL: SELECT r1."C 1", r1.c3, r2.c2 FROM ("S 1"."T 1" r1 FULL JOIN "S 1"."T 1" r2 ON (((r1."C 1" = r2."C 1"))))
1530+
(7 rows)
1531+
1532+
ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw');
15041533
-- join two tables with FOR UPDATE clause
15051534
-- tests whole-row reference for row marks
15061535
EXPLAIN (VERBOSE, COSTS OFF)

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,6 +3990,15 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
39903990
joinclauses = NIL;
39913991
}
39923992

3993+
/* Get foreign server */
3994+
fpinfo->server = fpinfo_o->server;
3995+
3996+
/*
3997+
* Copy shippable_extensions before checking whether the foreign join is
3998+
* OK, so that we know which quals can be evaluated on the foreign server.
3999+
*/
4000+
fpinfo->shippable_extensions = fpinfo_o->shippable_extensions;
4001+
39934002
/* Join quals must be safe to push down. */
39944003
foreach(lc, joinclauses)
39954004
{
@@ -4133,9 +4142,6 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
41334142
else
41344143
fpinfo->user = NULL;
41354144

4136-
/* Get foreign server */
4137-
fpinfo->server = fpinfo_o->server;
4138-
41394145
/*
41404146
* Since both the joining relations come from the same server, the server
41414147
* level options should have same value for both the relations. Pick from

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,14 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT
422422
EXPLAIN (VERBOSE, COSTS OFF)
423423
SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) WHERE (t1.c1 = t2.c1 OR t1.c1 IS NULL) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
424424
SELECT t1.c1, t2.c1 FROM ft4 t1 FULL JOIN ft5 t2 ON (t1.c1 = t2.c1) WHERE (t1.c1 = t2.c1 OR t1.c1 IS NULL) ORDER BY t1.c1, t2.c1 OFFSET 10 LIMIT 10;
425+
-- full outer join + WHERE clause with shippable extensions set
426+
EXPLAIN (VERBOSE, COSTS OFF)
427+
SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE postgres_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10;
428+
ALTER SERVER loopback OPTIONS (DROP extensions);
429+
-- full outer join + WHERE clause with shippable extensions not set
430+
EXPLAIN (VERBOSE, COSTS OFF)
431+
SELECT t1.c1, t2.c2, t1.c3 FROM ft1 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) WHERE postgres_fdw_abs(t1.c1) > 0 OFFSET 10 LIMIT 10;
432+
ALTER SERVER loopback OPTIONS (ADD extensions 'postgres_fdw');
425433
-- join two tables with FOR UPDATE clause
426434
-- tests whole-row reference for row marks
427435
EXPLAIN (VERBOSE, COSTS OFF)

doc/bug.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ System Configuration:
2727

2828
Operating System (example: Linux 2.4.18) :
2929

30-
PostgreSQL version (example: PostgreSQL 9.6.2): PostgreSQL 9.6.2
30+
PostgreSQL version (example: PostgreSQL 9.6.3): PostgreSQL 9.6.3
3131

3232
Compiler used (example: gcc 3.3.5) :
3333

doc/src/sgml/catalogs.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10059,8 +10059,11 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
1005910059
<entry></entry>
1006010060
<entry>
1006110061
User mapping specific options, as <quote>keyword=value</>
10062-
strings, if the current user is the owner of the foreign
10063-
server, else null
10062+
strings. This column will show as null unless the current user
10063+
is the user being mapped, or the mapping is for
10064+
<literal>PUBLIC</literal> and the current user is the server
10065+
owner, or the current user is a superuser. The intent is
10066+
to protect password information stored as user mapping option.
1006410067
</entry>
1006510068
</row>
1006610069
</tbody>

doc/src/sgml/func.sgml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15306,6 +15306,12 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
1530615306
by the client (might contain more than one statement)</entry>
1530715307
</row>
1530815308

15309+
<row>
15310+
<entry><literal><function>current_role</function></literal></entry>
15311+
<entry><type>name</type></entry>
15312+
<entry>equivalent to <function>current_user</function></entry>
15313+
</row>
15314+
1530915315
<row>
1531015316
<entry><literal><function>current_schema</function>[()]</literal></entry>
1531115317
<entry><type>name</type></entry>
@@ -15439,8 +15445,11 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
1543915445

1544015446
<note>
1544115447
<para>
15442-
<function>current_catalog</function>, <function>current_schema</function>,
15443-
<function>current_user</function>, <function>session_user</function>,
15448+
<function>current_catalog</function>,
15449+
<function>current_role</function>,
15450+
<function>current_schema</function>,
15451+
<function>current_user</function>,
15452+
<function>session_user</function>,
1544415453
and <function>user</function> have special syntactic status
1544515454
in <acronym>SQL</acronym>: they must be called without trailing
1544615455
parentheses. (In &productname;, parentheses can optionally be used with
@@ -15460,6 +15469,10 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
1546015469
<primary>current_query</primary>
1546115470
</indexterm>
1546215471

15472+
<indexterm>
15473+
<primary>current_role</primary>
15474+
</indexterm>
15475+
1546315476
<indexterm>
1546415477
<primary>current_schema</primary>
1546515478
</indexterm>
@@ -15511,6 +15524,11 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
1551115524
functions with the attribute <literal>SECURITY DEFINER</literal>.
1551215525
In Unix parlance, the session user is the <quote>real user</quote> and
1551315526
the current user is the <quote>effective user</quote>.
15527+
<function>current_role</function> and <function>user</function> are
15528+
synonyms for <function>current_user</function>. (The SQL standard draws
15529+
a distinction between <function>current_role</function>
15530+
and <function>current_user</function>, but <productname>PostgreSQL</>
15531+
does not, since it unifies users and roles into a single kind of entity.)
1551415532
</para>
1551515533

1551615534
<para>

doc/src/sgml/libpq.sgml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6944,6 +6944,9 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
69446944
</indexterm>
69456945
<envar>PGREQUIRESSL</envar> behaves the same as the <xref
69466946
linkend="libpq-connect-requiressl"> connection parameter.
6947+
This environment variable is deprecated in favor of the
6948+
<envar>PGSSLMODE</envar> variable; setting both variables suppresses the
6949+
effect of this one.
69476950
</para>
69486951
</listitem>
69496952

doc/src/sgml/planstats.sgml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,64 @@ rows = (outer_cardinality * inner_cardinality) * selectivity
448448

449449
</sect1>
450450

451+
<sect1 id="planner-stats-security">
452+
<title>Planner Statistics and Security</title>
453+
454+
<para>
455+
Access to the table <structname>pg_statistic</structname> is restricted to
456+
superusers, so that ordinary users cannot learn about the contents of the
457+
tables of other users from it. Some selectivity estimation functions will
458+
use a user-provided operator (either the operator appearing in the query or
459+
a related operator) to analyze the stored statistics. For example, in order
460+
to determine whether a stored most common value is applicable, the
461+
selectivity estimator will have to run the appropriate <literal>=</literal>
462+
operator to compare the constant in the query to the stored value.
463+
Thus the data in <structname>pg_statistic</structname> is potentially
464+
passed to user-defined operators. An appropriately crafted operator can
465+
intentionally leak the passed operands (for example, by logging them
466+
or writing them to a different table), or accidentally leak them by showing
467+
their values in error messages, in either case possibly exposing data from
468+
<structname>pg_statistic</structname> to a user who should not be able to
469+
see it.
470+
</para>
471+
472+
<para>
473+
In order to prevent this, the following applies to all built-in selectivity
474+
estimation functions. When planning a query, in order to be able to use
475+
stored statistics, the current user must either
476+
have <literal>SELECT</literal> privilege on the table or the involved
477+
columns, or the operator used must be <literal>LEAKPROOF</literal> (more
478+
accurately, the function that the operator is based on). If not, then the
479+
selectivity estimator will behave as if no statistics are available, and
480+
the planner will proceed with default or fall-back assumptions.
481+
</para>
482+
483+
<para>
484+
If a user does not have the required privilege on the table or columns,
485+
then in many cases the query will ultimately receive a permission-denied
486+
error, in which case this mechanism is invisible in practice. But if the
487+
user is reading from a security-barrier view, then the planner might wish
488+
to check the statistics of an underlying table that is otherwise
489+
inaccessible to the user. In that case, the operator should be leak-proof
490+
or the statistics will not be used. There is no direct feedback about
491+
that, except that the plan might be suboptimal. If one suspects that this
492+
is the case, one could try running the query as a more privileged user,
493+
to see if a different plan results.
494+
</para>
495+
496+
<para>
497+
This restriction applies only to cases where the planner would need to
498+
execute a user-defined operator on one or more values
499+
from <structname>pg_statistic</structname>. Thus the planner is permitted
500+
to use generic statistical information, such as the fraction of null values
501+
or the number of distinct values in a column, regardless of access
502+
privileges.
503+
</para>
504+
505+
<para>
506+
Selectivity estimation functions contained in third-party extensions that
507+
potentially operate on statistics with user-defined operators should follow
508+
the same security rules. Consult the PostgreSQL source code for guidance.
509+
</para>
510+
</sect1>
451511
</chapter>

0 commit comments

Comments
 (0)