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

Commit 024f147

Browse files
committed
Merge branch 'REL9_6_STABLE' into PGPRO9_6
2 parents e139d38 + 0cd9071 commit 024f147

File tree

31 files changed

+229
-162
lines changed

31 files changed

+229
-162
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ all check install installdirs installcheck installcheck-parallel uninstall clean
2929
\
3030
if [ x"$${GMAKE+set}" = xset ]; then \
3131
echo "Using GNU make found at $${GMAKE}"; \
32+
unset MAKEFLAGS; unset MAKELEVEL; \
3233
$${GMAKE} $@ ; \
3334
else \
3435
echo "You must use GNU make to build PostgreSQL." ; \

config/perl.m4

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
5959
# to a different libc ABI than core Postgres uses. The available information
6060
# says that all the symbols that affect Perl's own ABI begin with letters,
6161
# so it should be sufficient to adopt -D switches for symbols not beginning
62-
# with underscore.
62+
# with underscore. An exception is that we need to let through
63+
# -D_USE_32BIT_TIME_T if it's present. (We probably could restrict that to
64+
# only get through on Windows, but for the moment we let it through always.)
6365
# For debugging purposes, let's have the configure output report the raw
6466
# ccflags value as well as the set of flags we chose to adopt.
6567
AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS],
@@ -68,7 +70,7 @@ AC_MSG_CHECKING([for CFLAGS recommended by Perl])
6870
perl_ccflags=`$PERL -MConfig -e ['print $Config{ccflags}']`
6971
AC_MSG_RESULT([$perl_ccflags])
7072
AC_MSG_CHECKING([for CFLAGS to compile embedded Perl])
71-
perl_embed_ccflags=`$PERL -MConfig -e ['foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/)}']`
73+
perl_embed_ccflags=`$PERL -MConfig -e ['foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}']`
7274
AC_SUBST(perl_embed_ccflags)dnl
7375
AC_MSG_RESULT([$perl_embed_ccflags])
7476
])# PGAC_CHECK_PERL_EMBED_CCFLAGS

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7584,7 +7584,7 @@ perl_ccflags=`$PERL -MConfig -e 'print $Config{ccflags}'`
75847584
$as_echo "$perl_ccflags" >&6; }
75857585
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAGS to compile embedded Perl" >&5
75867586
$as_echo_n "checking for CFLAGS to compile embedded Perl... " >&6; }
7587-
perl_embed_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/)}'`
7587+
perl_embed_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}'`
75887588
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_embed_ccflags" >&5
75897589
$as_echo "$perl_embed_ccflags" >&6; }
75907590

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4261,7 +4261,6 @@ postgresGetForeignJoinPaths(PlannerInfo *root,
42614261
* the path list of the joinrel, if one exists. We must be careful to
42624262
* call it before adding any ForeignPath, since the ForeignPath might
42634263
* dominate the only suitable local path available. We also do it before
4264-
* reconstruct the row for EvalPlanQual(). Find an alternative local path
42654264
* calling foreign_join_ok(), since that function updates fpinfo and marks
42664265
* it as pushable if the join is found to be pushable.
42674266
*/

doc/src/sgml/catalogs.sgml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,10 +1280,8 @@
12801280
<entry><structfield>rolreplication</structfield></entry>
12811281
<entry><type>bool</type></entry>
12821282
<entry>
1283-
Role is a replication role. That is, this role can initiate streaming
1284-
replication (see <xref linkend="streaming-replication">) and set/unset
1285-
the system backup mode using <function>pg_start_backup</> and
1286-
<function>pg_stop_backup</>
1283+
Role is a replication role. A replication role can initiate replication
1284+
connections and create and drop replication slots.
12871285
</entry>
12881286
</row>
12891287

@@ -8914,10 +8912,8 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
89148912
<entry><type>bool</type></entry>
89158913
<entry></entry>
89168914
<entry>
8917-
Role is a replication role. That is, this role can initiate streaming
8918-
replication (see <xref linkend="streaming-replication">) and set/unset
8919-
the system backup mode using <function>pg_start_backup</> and
8920-
<function>pg_stop_backup</>
8915+
Role is a replication role. A replication role can initiate replication
8916+
connections and create and drop replication slots.
89218917
</entry>
89228918
</row>
89238919

doc/src/sgml/ref/create_role.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
167167
<term><literal>NOREPLICATION</literal></term>
168168
<listitem>
169169
<para>
170-
These clauses determine whether a role is allowed to initiate
171-
streaming replication or put the system in and out of backup mode.
170+
These clauses determine whether a role is a replication role. A role
171+
must have this attribute (or be a superuser) in order to be able to
172+
connect to the server in replication mode (physical or logical
173+
replication) and in order to be able to create or drop replication
174+
slots.
172175
A role having the <literal>REPLICATION</> attribute is a very
173176
highly privileged role, and should only be used on roles actually
174177
used for replication. If not specified,

src/backend/access/heap/heapam.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3934,7 +3934,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
39343934

39353935
/*
39363936
* To prevent concurrent sessions from updating the tuple, we have to
3937-
* temporarily mark it locked, while we release the lock.
3937+
* temporarily mark it locked, while we release the page-level lock.
39383938
*
39393939
* To satisfy the rule that any xid potentially appearing in a buffer
39403940
* written out to disk, we unfortunately have to WAL log this
@@ -3946,8 +3946,9 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
39463946

39473947
/*
39483948
* Compute xmax / infomask appropriate for locking the tuple. This has
3949-
* to be done separately from the lock, because the potentially
3950-
* created multixact would otherwise be wrong.
3949+
* to be done separately from the combo that's going to be used for
3950+
* updating, because the potentially created multixact would otherwise
3951+
* be wrong.
39513952
*/
39523953
compute_new_xmax_infomask(HeapTupleHeaderGetRawXmax(oldtup.t_data),
39533954
oldtup.t_data->t_infomask,

src/backend/access/transam/xact.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,9 +2124,6 @@ CommitTransaction(void)
21242124
*/
21252125
smgrDoPendingDeletes(true);
21262126

2127-
/* Check we've released all catcache entries */
2128-
AtEOXact_CatCache(true);
2129-
21302127
AtCommit_Notify();
21312128
AtEOXact_GUC(true, 1);
21322129
AtEOXact_SPI(true);
@@ -2395,9 +2392,6 @@ PrepareTransaction(void)
23952392
*/
23962393
PostPrepare_Twophase();
23972394

2398-
/* Check we've released all catcache entries */
2399-
AtEOXact_CatCache(true);
2400-
24012395
/* PREPARE acts the same as COMMIT as far as GUC is concerned */
24022396
AtEOXact_GUC(true, 1);
24032397
AtEOXact_SPI(true);
@@ -2597,7 +2591,6 @@ AbortTransaction(void)
25972591
RESOURCE_RELEASE_AFTER_LOCKS,
25982592
false, true);
25992593
smgrDoPendingDeletes(false);
2600-
AtEOXact_CatCache(false);
26012594

26022595
AtEOXact_GUC(false, 1);
26032596
AtEOXact_SPI(false);
@@ -4219,6 +4212,9 @@ AbortOutOfAnyTransaction(void)
42194212
{
42204213
TransactionState s = CurrentTransactionState;
42214214

4215+
/* Ensure we're not running in a doomed memory context */
4216+
AtAbort_Memory();
4217+
42224218
/*
42234219
* Get out of any transaction or nested transaction
42244220
*/
@@ -4260,7 +4256,14 @@ AbortOutOfAnyTransaction(void)
42604256
break;
42614257
case TBLOCK_ABORT:
42624258
case TBLOCK_ABORT_END:
4263-
/* AbortTransaction already done, still need Cleanup */
4259+
4260+
/*
4261+
* AbortTransaction is already done, still need Cleanup.
4262+
* However, if we failed partway through running ROLLBACK,
4263+
* there will be an active portal running that command, which
4264+
* we need to shut down before doing CleanupTransaction.
4265+
*/
4266+
AtAbort_Portals();
42644267
CleanupTransaction();
42654268
s->blockState = TBLOCK_DEFAULT;
42664269
break;
@@ -4283,6 +4286,14 @@ AbortOutOfAnyTransaction(void)
42834286
case TBLOCK_SUBABORT_END:
42844287
case TBLOCK_SUBABORT_RESTART:
42854288
/* As above, but AbortSubTransaction already done */
4289+
if (s->curTransactionOwner)
4290+
{
4291+
/* As in TBLOCK_ABORT, might have a live portal to zap */
4292+
AtSubAbort_Portals(s->subTransactionId,
4293+
s->parent->subTransactionId,
4294+
s->curTransactionOwner,
4295+
s->parent->curTransactionOwner);
4296+
}
42864297
CleanupSubTransaction();
42874298
s = CurrentTransactionState; /* changed by pop */
42884299
break;
@@ -4291,6 +4302,9 @@ AbortOutOfAnyTransaction(void)
42914302

42924303
/* Should be out of all subxacts now */
42934304
Assert(s->parent == NULL);
4305+
4306+
/* If we didn't actually have anything to do, revert to TopMemoryContext */
4307+
AtCleanup_Memory();
42944308
}
42954309

42964310
/*

src/backend/catalog/information_schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ CREATE VIEW table_privileges AS
18531853
) AS grantee (oid, rolname)
18541854

18551855
WHERE c.relnamespace = nc.oid
1856-
AND c.relkind IN ('r', 'v')
1856+
AND c.relkind IN ('r', 'v', 'f')
18571857
AND c.grantee = grantee.oid
18581858
AND c.grantor = u_grantor.oid
18591859
AND c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER')

src/backend/commands/tablecmds.c

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,13 +4474,18 @@ ATTypedTableRecursion(List **wqueue, Relation rel, AlterTableCmd *cmd,
44744474
/*
44754475
* find_composite_type_dependencies
44764476
*
4477-
* Check to see if a composite type is being used as a column in some
4478-
* other table (possibly nested several levels deep in composite types!).
4477+
* Check to see if the type "typeOid" is being used as a column in some table
4478+
* (possibly nested several levels deep in composite types, arrays, etc!).
44794479
* Eventually, we'd like to propagate the check or rewrite operation
4480-
* into other such tables, but for now, just error out if we find any.
4480+
* into such tables, but for now, just error out if we find any.
44814481
*
4482-
* Caller should provide either a table name or a type name (not both) to
4483-
* report in the error message, if any.
4482+
* Caller should provide either the associated relation of a rowtype,
4483+
* or a type name (not both) for use in the error message, if any.
4484+
*
4485+
* Note that "typeOid" is not necessarily a composite type; it could also be
4486+
* another container type such as an array or range, or a domain over one of
4487+
* these things. The name of this function is therefore somewhat historical,
4488+
* but it's not worth changing.
44844489
*
44854490
* We assume that functions and views depending on the type are not reasons
44864491
* to reject the ALTER. (How safe is this really?)
@@ -4493,11 +4498,13 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
44934498
ScanKeyData key[2];
44944499
SysScanDesc depScan;
44954500
HeapTuple depTup;
4496-
Oid arrayOid;
4501+
4502+
/* since this function recurses, it could be driven to stack overflow */
4503+
check_stack_depth();
44974504

44984505
/*
4499-
* We scan pg_depend to find those things that depend on the rowtype. (We
4500-
* assume we can ignore refobjsubid for a rowtype.)
4506+
* We scan pg_depend to find those things that depend on the given type.
4507+
* (We assume we can ignore refobjsubid for a type.)
45014508
*/
45024509
depRel = heap_open(DependRelationId, AccessShareLock);
45034510

@@ -4519,8 +4526,22 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
45194526
Relation rel;
45204527
Form_pg_attribute att;
45214528

4522-
/* Ignore dependees that aren't user columns of relations */
4523-
/* (we assume system columns are never of rowtypes) */
4529+
/* Check for directly dependent types */
4530+
if (pg_depend->classid == TypeRelationId)
4531+
{
4532+
/*
4533+
* This must be an array, domain, or range containing the given
4534+
* type, so recursively check for uses of this type. Note that
4535+
* any error message will mention the original type not the
4536+
* container; this is intentional.
4537+
*/
4538+
find_composite_type_dependencies(pg_depend->objid,
4539+
origRelation, origTypeName);
4540+
continue;
4541+
}
4542+
4543+
/* Else, ignore dependees that aren't user columns of relations */
4544+
/* (we assume system columns are never of interesting types) */
45244545
if (pg_depend->classid != RelationRelationId ||
45254546
pg_depend->objsubid <= 0)
45264547
continue;
@@ -4576,14 +4597,6 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
45764597
systable_endscan(depScan);
45774598

45784599
relation_close(depRel, AccessShareLock);
4579-
4580-
/*
4581-
* If there's an array type for the rowtype, must check for uses of it,
4582-
* too.
4583-
*/
4584-
arrayOid = get_array_type(typeOid);
4585-
if (OidIsValid(arrayOid))
4586-
find_composite_type_dependencies(arrayOid, origRelation, origTypeName);
45874600
}
45884601

45894602

src/backend/commands/typecmds.c

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,10 +2798,9 @@ validateDomainConstraint(Oid domainoid, char *ccbin)
27982798
* risk by using the weakest suitable lock (ShareLock for most callers).
27992799
*
28002800
* XXX the API for this is not sufficient to support checking domain values
2801-
* that are inside composite types or arrays. Currently we just error out
2802-
* if a composite type containing the target domain is stored anywhere.
2803-
* There are not currently arrays of domains; if there were, we could take
2804-
* the same approach, but it'd be nicer to fix it properly.
2801+
* that are inside container types, such as composite types, arrays, or
2802+
* ranges. Currently we just error out if a container type containing the
2803+
* target domain is stored anywhere.
28052804
*
28062805
* Generally used for retrieving a list of tests when adding
28072806
* new constraints to a domain.
@@ -2810,13 +2809,17 @@ static List *
28102809
get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
28112810
{
28122811
List *result = NIL;
2812+
char *domainTypeName = format_type_be(domainOid);
28132813
Relation depRel;
28142814
ScanKeyData key[2];
28152815
SysScanDesc depScan;
28162816
HeapTuple depTup;
28172817

28182818
Assert(lockmode != NoLock);
28192819

2820+
/* since this function recurses, it could be driven to stack overflow */
2821+
check_stack_depth();
2822+
28202823
/*
28212824
* We scan pg_depend to find those things that depend on the domain. (We
28222825
* assume we can ignore refobjsubid for a domain.)
@@ -2843,20 +2846,32 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
28432846
Form_pg_attribute pg_att;
28442847
int ptr;
28452848

2846-
/* Check for directly dependent types --- must be domains */
2849+
/* Check for directly dependent types */
28472850
if (pg_depend->classid == TypeRelationId)
28482851
{
2849-
Assert(get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN);
2850-
2851-
/*
2852-
* Recursively add dependent columns to the output list. This is
2853-
* a bit inefficient since we may fail to combine RelToCheck
2854-
* entries when attributes of the same rel have different derived
2855-
* domain types, but it's probably not worth improving.
2856-
*/
2857-
result = list_concat(result,
2858-
get_rels_with_domain(pg_depend->objid,
2859-
lockmode));
2852+
if (get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN)
2853+
{
2854+
/*
2855+
* This is a sub-domain, so recursively add dependent columns
2856+
* to the output list. This is a bit inefficient since we may
2857+
* fail to combine RelToCheck entries when attributes of the
2858+
* same rel have different derived domain types, but it's
2859+
* probably not worth improving.
2860+
*/
2861+
result = list_concat(result,
2862+
get_rels_with_domain(pg_depend->objid,
2863+
lockmode));
2864+
}
2865+
else
2866+
{
2867+
/*
2868+
* Otherwise, it is some container type using the domain, so
2869+
* fail if there are any columns of this type.
2870+
*/
2871+
find_composite_type_dependencies(pg_depend->objid,
2872+
NULL,
2873+
domainTypeName);
2874+
}
28602875
continue;
28612876
}
28622877

@@ -2893,7 +2908,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
28932908
if (OidIsValid(rel->rd_rel->reltype))
28942909
find_composite_type_dependencies(rel->rd_rel->reltype,
28952910
NULL,
2896-
format_type_be(domainOid));
2911+
domainTypeName);
28972912

28982913
/*
28992914
* Otherwise, we can ignore relations except those with both

src/backend/commands/vacuumlazy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats,
13471347
"%u pages are entirely empty.\n",
13481348
empty_pages),
13491349
empty_pages);
1350-
appendStringInfo(&buf, "%s.", pg_rusage_show(&ru0));
1350+
appendStringInfo(&buf, _("%s."), pg_rusage_show(&ru0));
13511351

13521352
ereport(elevel,
13531353
(errmsg("\"%s\": found %.0f removable, %.0f nonremovable row versions in %u out of %u pages",

src/backend/po/es.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12561,7 +12561,7 @@ msgstr[1] "el método de tablesample «%s» requiere %d argumentos, no %d"
1256112561
#: parser/parse_clause.c:809
1256212562
#, c-format
1256312563
msgid "tablesample method %s does not support REPEATABLE"
12564-
msgstr "el método de tablesample «%s» no soporta la opción REPEATABLE"
12564+
msgstr "el método de tablesample «%s» no soporta la opción REPEATABLE"
1256512565

1256612566
#: parser/parse_clause.c:940
1256712567
#, c-format

src/backend/storage/ipc/procarray.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,14 @@ CreateSharedProcArray(void)
239239
*/
240240
procArray->numProcs = 0;
241241
procArray->maxProcs = PROCARRAY_MAXPROCS;
242-
procArray->replication_slot_xmin = InvalidTransactionId;
243242
procArray->maxKnownAssignedXids = TOTAL_MAX_CACHED_SUBXIDS;
244243
procArray->numKnownAssignedXids = 0;
245244
procArray->tailKnownAssignedXids = 0;
246245
procArray->headKnownAssignedXids = 0;
247246
SpinLockInit(&procArray->known_assigned_xids_lck);
248247
procArray->lastOverflowedXid = InvalidTransactionId;
248+
procArray->replication_slot_xmin = InvalidTransactionId;
249+
procArray->replication_slot_catalog_xmin = InvalidTransactionId;
249250
}
250251

251252
allProcs = ProcGlobal->allProcs;

0 commit comments

Comments
 (0)