Skip to content

Commit 61693a8

Browse files
authored
Merge pull request #137 from postgres/master
Sync Fork from Upstream Repo
2 parents aaa8082 + 9b14280 commit 61693a8

File tree

291 files changed

+5437
-3751
lines changed

Some content is hidden

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

291 files changed

+5437
-3751
lines changed

configure

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5643,6 +5643,97 @@ if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" = x"yes"; then
56435643
fi
56445644

56455645

5646+
5647+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type, for CFLAGS" >&5
5648+
$as_echo_n "checking whether ${CC} supports -Wcast-function-type, for CFLAGS... " >&6; }
5649+
if ${pgac_cv_prog_CC_cflags__Wcast_function_type+:} false; then :
5650+
$as_echo_n "(cached) " >&6
5651+
else
5652+
pgac_save_CFLAGS=$CFLAGS
5653+
pgac_save_CC=$CC
5654+
CC=${CC}
5655+
CFLAGS="${CFLAGS} -Wcast-function-type"
5656+
ac_save_c_werror_flag=$ac_c_werror_flag
5657+
ac_c_werror_flag=yes
5658+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5659+
/* end confdefs.h. */
5660+
5661+
int
5662+
main ()
5663+
{
5664+
5665+
;
5666+
return 0;
5667+
}
5668+
_ACEOF
5669+
if ac_fn_c_try_compile "$LINENO"; then :
5670+
pgac_cv_prog_CC_cflags__Wcast_function_type=yes
5671+
else
5672+
pgac_cv_prog_CC_cflags__Wcast_function_type=no
5673+
fi
5674+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5675+
ac_c_werror_flag=$ac_save_c_werror_flag
5676+
CFLAGS="$pgac_save_CFLAGS"
5677+
CC="$pgac_save_CC"
5678+
fi
5679+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type" >&5
5680+
$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type" >&6; }
5681+
if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type" = x"yes"; then
5682+
CFLAGS="${CFLAGS} -Wcast-function-type"
5683+
fi
5684+
5685+
5686+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wcast-function-type, for CXXFLAGS" >&5
5687+
$as_echo_n "checking whether ${CXX} supports -Wcast-function-type, for CXXFLAGS... " >&6; }
5688+
if ${pgac_cv_prog_CXX_cxxflags__Wcast_function_type+:} false; then :
5689+
$as_echo_n "(cached) " >&6
5690+
else
5691+
pgac_save_CXXFLAGS=$CXXFLAGS
5692+
pgac_save_CXX=$CXX
5693+
CXX=${CXX}
5694+
CXXFLAGS="${CXXFLAGS} -Wcast-function-type"
5695+
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
5696+
ac_cxx_werror_flag=yes
5697+
ac_ext=cpp
5698+
ac_cpp='$CXXCPP $CPPFLAGS'
5699+
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
5700+
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
5701+
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
5702+
5703+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5704+
/* end confdefs.h. */
5705+
5706+
int
5707+
main ()
5708+
{
5709+
5710+
;
5711+
return 0;
5712+
}
5713+
_ACEOF
5714+
if ac_fn_cxx_try_compile "$LINENO"; then :
5715+
pgac_cv_prog_CXX_cxxflags__Wcast_function_type=yes
5716+
else
5717+
pgac_cv_prog_CXX_cxxflags__Wcast_function_type=no
5718+
fi
5719+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
5720+
ac_ext=c
5721+
ac_cpp='$CPP $CPPFLAGS'
5722+
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
5723+
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
5724+
ac_compiler_gnu=$ac_cv_c_compiler_gnu
5725+
5726+
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
5727+
CXXFLAGS="$pgac_save_CXXFLAGS"
5728+
CXX="$pgac_save_CXX"
5729+
fi
5730+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wcast_function_type" >&5
5731+
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wcast_function_type" >&6; }
5732+
if test x"$pgac_cv_prog_CXX_cxxflags__Wcast_function_type" = x"yes"; then
5733+
CXXFLAGS="${CXXFLAGS} -Wcast-function-type"
5734+
fi
5735+
5736+
56465737
# This was included in -Wall/-Wformat in older GCC versions
56475738

56485739
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-security, for CFLAGS" >&5

configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ if test "$GCC" = yes -a "$ICC" = no; then
498498
PGAC_PROG_CXX_CFLAGS_OPT([-Wmissing-format-attribute])
499499
PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=3])
500500
PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=3])
501+
PGAC_PROG_CC_CFLAGS_OPT([-Wcast-function-type])
502+
PGAC_PROG_CXX_CFLAGS_OPT([-Wcast-function-type])
501503
# This was included in -Wall/-Wformat in older GCC versions
502504
PGAC_PROG_CC_CFLAGS_OPT([-Wformat-security])
503505
PGAC_PROG_CXX_CFLAGS_OPT([-Wformat-security])

contrib/adminpack/expected/adminpack.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ SELECT pg_file_rename('test_file1', 'test_file2');
7979
(1 row)
8080

8181
SELECT pg_read_file('test_file1'); -- not there
82-
ERROR: could not stat file "test_file1": No such file or directory
82+
ERROR: could not open file "test_file1" for reading: No such file or directory
8383
SELECT pg_read_file('test_file2');
8484
pg_read_file
8585
--------------
@@ -108,7 +108,7 @@ SELECT pg_file_rename('test_file2', 'test_file3', 'test_file3_archive');
108108
(1 row)
109109

110110
SELECT pg_read_file('test_file2'); -- not there
111-
ERROR: could not stat file "test_file2": No such file or directory
111+
ERROR: could not open file "test_file2" for reading: No such file or directory
112112
SELECT pg_read_file('test_file3');
113113
pg_read_file
114114
--------------

contrib/bloom/t/001_wal.pl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use TestLib;
66
use Test::More tests => 31;
77

8-
my $node_master;
8+
my $node_primary;
99
my $node_standby;
1010

11-
# Run few queries on both master and standby and check their results match.
11+
# Run few queries on both primary and standby and check their results match.
1212
sub test_index_replay
1313
{
1414
my ($test_name) = @_;
@@ -17,7 +17,7 @@ sub test_index_replay
1717
my $applname = $node_standby->name;
1818
my $caughtup_query =
1919
"SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';";
20-
$node_master->poll_query_until('postgres', $caughtup_query)
20+
$node_primary->poll_query_until('postgres', $caughtup_query)
2121
or die "Timed out while waiting for standby 1 to catch up";
2222

2323
my $queries = qq(SET enable_seqscan=off;
@@ -32,35 +32,35 @@ sub test_index_replay
3232
);
3333

3434
# Run test queries and compare their result
35-
my $master_result = $node_master->safe_psql("postgres", $queries);
35+
my $primary_result = $node_primary->safe_psql("postgres", $queries);
3636
my $standby_result = $node_standby->safe_psql("postgres", $queries);
3737

38-
is($master_result, $standby_result, "$test_name: query result matches");
38+
is($primary_result, $standby_result, "$test_name: query result matches");
3939
return;
4040
}
4141

42-
# Initialize master node
43-
$node_master = get_new_node('master');
44-
$node_master->init(allows_streaming => 1);
45-
$node_master->start;
42+
# Initialize primary node
43+
$node_primary = get_new_node('primary');
44+
$node_primary->init(allows_streaming => 1);
45+
$node_primary->start;
4646
my $backup_name = 'my_backup';
4747

4848
# Take backup
49-
$node_master->backup($backup_name);
49+
$node_primary->backup($backup_name);
5050

51-
# Create streaming standby linking to master
51+
# Create streaming standby linking to primary
5252
$node_standby = get_new_node('standby');
53-
$node_standby->init_from_backup($node_master, $backup_name,
53+
$node_standby->init_from_backup($node_primary, $backup_name,
5454
has_streaming => 1);
5555
$node_standby->start;
5656

57-
# Create some bloom index on master
58-
$node_master->safe_psql("postgres", "CREATE EXTENSION bloom;");
59-
$node_master->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);");
60-
$node_master->safe_psql("postgres",
57+
# Create some bloom index on primary
58+
$node_primary->safe_psql("postgres", "CREATE EXTENSION bloom;");
59+
$node_primary->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);");
60+
$node_primary->safe_psql("postgres",
6161
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;"
6262
);
63-
$node_master->safe_psql("postgres",
63+
$node_primary->safe_psql("postgres",
6464
"CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);");
6565

6666
# Test that queries give same result
@@ -69,12 +69,12 @@ sub test_index_replay
6969
# Run 10 cycles of table modification. Run test queries after each modification.
7070
for my $i (1 .. 10)
7171
{
72-
$node_master->safe_psql("postgres", "DELETE FROM tst WHERE i = $i;");
72+
$node_primary->safe_psql("postgres", "DELETE FROM tst WHERE i = $i;");
7373
test_index_replay("delete $i");
74-
$node_master->safe_psql("postgres", "VACUUM tst;");
74+
$node_primary->safe_psql("postgres", "VACUUM tst;");
7575
test_index_replay("vacuum $i");
7676
my ($start, $end) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000);
77-
$node_master->safe_psql("postgres",
77+
$node_primary->safe_psql("postgres",
7878
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;"
7979
);
8080
test_index_replay("insert $i");

contrib/pg_prewarm/autoprewarm.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* pages from a relation that is in the process of being dropped.
1212
*
1313
* While prewarming, autoprewarm will use two workers. There's a
14-
* master worker that reads and sorts the list of blocks to be
14+
* leader worker that reads and sorts the list of blocks to be
1515
* prewarmed and then launches a per-database worker for each
1616
* relevant database in turn. The former keeps running after the
1717
* initial prewarm is complete to update the dump file periodically.
@@ -88,7 +88,7 @@ PG_FUNCTION_INFO_V1(autoprewarm_dump_now);
8888

8989
static void apw_load_buffers(void);
9090
static int apw_dump_now(bool is_bgworker, bool dump_unlogged);
91-
static void apw_start_master_worker(void);
91+
static void apw_start_leader_worker(void);
9292
static void apw_start_database_worker(void);
9393
static bool apw_init_shmem(void);
9494
static void apw_detach_shmem(int code, Datum arg);
@@ -146,11 +146,11 @@ _PG_init(void)
146146

147147
/* Register autoprewarm worker, if enabled. */
148148
if (autoprewarm)
149-
apw_start_master_worker();
149+
apw_start_leader_worker();
150150
}
151151

152152
/*
153-
* Main entry point for the master autoprewarm process. Per-database workers
153+
* Main entry point for the leader autoprewarm process. Per-database workers
154154
* have a separate entry point.
155155
*/
156156
void
@@ -716,7 +716,7 @@ autoprewarm_start_worker(PG_FUNCTION_ARGS)
716716
errmsg("autoprewarm worker is already running under PID %lu",
717717
(unsigned long) pid)));
718718

719-
apw_start_master_worker();
719+
apw_start_leader_worker();
720720

721721
PG_RETURN_VOID();
722722
}
@@ -786,10 +786,10 @@ apw_detach_shmem(int code, Datum arg)
786786
}
787787

788788
/*
789-
* Start autoprewarm master worker process.
789+
* Start autoprewarm leader worker process.
790790
*/
791791
static void
792-
apw_start_master_worker(void)
792+
apw_start_leader_worker(void)
793793
{
794794
BackgroundWorker worker;
795795
BackgroundWorkerHandle *handle;
@@ -801,8 +801,8 @@ apw_start_master_worker(void)
801801
worker.bgw_start_time = BgWorkerStart_ConsistentState;
802802
strcpy(worker.bgw_library_name, "pg_prewarm");
803803
strcpy(worker.bgw_function_name, "autoprewarm_main");
804-
strcpy(worker.bgw_name, "autoprewarm master");
805-
strcpy(worker.bgw_type, "autoprewarm master");
804+
strcpy(worker.bgw_name, "autoprewarm leader");
805+
strcpy(worker.bgw_type, "autoprewarm leader");
806806

807807
if (process_shared_preload_libraries_in_progress)
808808
{

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Track statement planning and execution times as well as resource
55
* usage across a whole database cluster.
66
*
7-
* Execution costs are totalled for each distinct source query, and kept in
7+
* Execution costs are totaled for each distinct source query, and kept in
88
* a shared hashtable. (We track only as many distinct queries as will fit
99
* in the designated amount of shared memory.)
1010
*

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,7 @@ select sum(c1) from ft1 group by c2 having avg(c1 * (random() <= 1)::int) > 100
27152715
Group Key: ft1.c2
27162716
Filter: (avg((ft1.c1 * ((random() <= '1'::double precision))::integer)) > '100'::numeric)
27172717
-> Foreign Scan on public.ft1
2718-
Output: c2, c1
2718+
Output: c1, c2
27192719
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1"
27202720
(10 rows)
27212721

@@ -2964,7 +2964,7 @@ select sum(c1) filter (where (c1 / c1) * random() <= 1) from ft1 group by c2 ord
29642964
Output: sum(c1) FILTER (WHERE ((((c1 / c1))::double precision * random()) <= '1'::double precision)), c2
29652965
Group Key: ft1.c2
29662966
-> Foreign Scan on public.ft1
2967-
Output: c2, c1
2967+
Output: c1, c2
29682968
Remote SQL: SELECT "C 1", c2 FROM "S 1"."T 1"
29692969
(9 rows)
29702970

contrib/sepgsql/database.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ sepgsql_database_drop(Oid databaseId)
142142
object.classId = DatabaseRelationId;
143143
object.objectId = databaseId;
144144
object.objectSubId = 0;
145-
audit_name = getObjectIdentity(&object);
145+
audit_name = getObjectIdentity(&object, false);
146146

147147
sepgsql_avc_check_perms(&object,
148148
SEPG_CLASS_DB_DATABASE,
@@ -169,7 +169,7 @@ sepgsql_database_setattr(Oid databaseId)
169169
object.classId = DatabaseRelationId;
170170
object.objectId = databaseId;
171171
object.objectSubId = 0;
172-
audit_name = getObjectIdentity(&object);
172+
audit_name = getObjectIdentity(&object, false);
173173

174174
sepgsql_avc_check_perms(&object,
175175
SEPG_CLASS_DB_DATABASE,
@@ -193,7 +193,7 @@ sepgsql_database_relabel(Oid databaseId, const char *seclabel)
193193
object.classId = DatabaseRelationId;
194194
object.objectId = databaseId;
195195
object.objectSubId = 0;
196-
audit_name = getObjectIdentity(&object);
196+
audit_name = getObjectIdentity(&object, false);
197197

198198
/*
199199
* check db_database:{setattr relabelfrom} permission

contrib/sepgsql/dml.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ check_relation_privileges(Oid relOid,
179179
object.classId = RelationRelationId;
180180
object.objectId = relOid;
181181
object.objectSubId = 0;
182-
audit_name = getObjectIdentity(&object);
182+
audit_name = getObjectIdentity(&object, false);
183183
switch (relkind)
184184
{
185185
case RELKIND_RELATION:
@@ -256,7 +256,7 @@ check_relation_privileges(Oid relOid,
256256
object.classId = RelationRelationId;
257257
object.objectId = relOid;
258258
object.objectSubId = attnum;
259-
audit_name = getObjectDescription(&object);
259+
audit_name = getObjectDescription(&object, false);
260260

261261
result = sepgsql_avc_check_perms(&object,
262262
SEPG_CLASS_DB_COLUMN,

contrib/sepgsql/label.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ sepgsql_fmgr_hook(FmgrHookEventType event,
355355
sepgsql_avc_check_perms(&object,
356356
SEPG_CLASS_DB_PROCEDURE,
357357
SEPG_DB_PROCEDURE__ENTRYPOINT,
358-
getObjectDescription(&object),
358+
getObjectDescription(&object, false),
359359
true);
360360

361361
sepgsql_avc_check_perms_label(stack->new_label,
@@ -523,7 +523,7 @@ sepgsql_object_relabel(const ObjectAddress *object, const char *seclabel)
523523
ereport(ERROR,
524524
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
525525
errmsg("sepgsql provider does not support labels on %s",
526-
getObjectTypeDescription(object))));
526+
getObjectTypeDescription(object, false))));
527527
break;
528528
}
529529
}

0 commit comments

Comments
 (0)