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

Commit 3c273f4

Browse files
committed
Merge branch 'PGPRO9_6' into PGPROEE9_6
2 parents ee3d2b6 + a42949e commit 3c273f4

File tree

31 files changed

+242
-163
lines changed

31 files changed

+242
-163
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: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ infodir
782782
docdir
783783
oldincludedir
784784
includedir
785+
runstatedir
785786
localstatedir
786787
sharedstatedir
787788
sysconfdir
@@ -907,6 +908,7 @@ datadir='${datarootdir}'
907908
sysconfdir='${prefix}/etc'
908909
sharedstatedir='${prefix}/com'
909910
localstatedir='${prefix}/var'
911+
runstatedir='${localstatedir}/run'
910912
includedir='${prefix}/include'
911913
oldincludedir='/usr/include'
912914
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1159,6 +1161,15 @@ do
11591161
| -silent | --silent | --silen | --sile | --sil)
11601162
silent=yes ;;
11611163

1164+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1165+
| --runstate | --runstat | --runsta | --runst | --runs \
1166+
| --run | --ru | --r)
1167+
ac_prev=runstatedir ;;
1168+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1169+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1170+
| --run=* | --ru=* | --r=*)
1171+
runstatedir=$ac_optarg ;;
1172+
11621173
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11631174
ac_prev=sbindir ;;
11641175
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1296,7 +1307,7 @@ fi
12961307
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12971308
datadir sysconfdir sharedstatedir localstatedir includedir \
12981309
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1299-
libdir localedir mandir
1310+
libdir localedir mandir runstatedir
13001311
do
13011312
eval ac_val=\$$ac_var
13021313
# Remove trailing slashes.
@@ -1449,6 +1460,7 @@ Fine tuning of the installation directories:
14491460
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14501461
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14511462
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1463+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14521464
--libdir=DIR object code libraries [EPREFIX/lib]
14531465
--includedir=DIR C header files [PREFIX/include]
14541466
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -7707,7 +7719,7 @@ perl_ccflags=`$PERL -MConfig -e 'print $Config{ccflags}'`
77077719
$as_echo "$perl_ccflags" >&6; }
77087720
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLAGS to compile embedded Perl" >&5
77097721
$as_echo_n "checking for CFLAGS to compile embedded Perl... " >&6; }
7710-
perl_embed_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/)}'`
7722+
perl_embed_ccflags=`$PERL -MConfig -e 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}'`
77117723
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perl_embed_ccflags" >&5
77127724
$as_echo "$perl_embed_ccflags" >&6; }
77137725

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

@@ -8919,10 +8917,8 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
89198917
<entry><type>bool</type></entry>
89208918
<entry></entry>
89218919
<entry>
8922-
Role is a replication role. That is, this role can initiate streaming
8923-
replication (see <xref linkend="streaming-replication">) and set/unset
8924-
the system backup mode using <function>pg_start_backup</> and
8925-
<function>pg_stop_backup</>
8920+
Role is a replication role. A replication role can initiate replication
8921+
connections and create and drop replication slots.
89268922
</entry>
89278923
</row>
89288924

doc/src/sgml/ref/create_role.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,11 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac
168168
<term><literal>NOREPLICATION</literal></term>
169169
<listitem>
170170
<para>
171-
These clauses determine whether a role is allowed to initiate
172-
streaming replication or put the system in and out of backup mode.
171+
These clauses determine whether a role is a replication role. A role
172+
must have this attribute (or be a superuser) in order to be able to
173+
connect to the server in replication mode (physical or logical
174+
replication) and in order to be able to create or drop replication
175+
slots.
173176
A role having the <literal>REPLICATION</> attribute is a very
174177
highly privileged role, and should only be used on roles actually
175178
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
@@ -4405,7 +4405,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
44054405

44064406
/*
44074407
* To prevent concurrent sessions from updating the tuple, we have to
4408-
* temporarily mark it locked, while we release the lock.
4408+
* temporarily mark it locked, while we release the page-level lock.
44094409
*
44104410
* To satisfy the rule that any xid potentially appearing in a buffer
44114411
* written out to disk, we unfortunately have to WAL log this
@@ -4417,8 +4417,9 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
44174417

44184418
/*
44194419
* Compute xmax / infomask appropriate for locking the tuple. This has
4420-
* to be done separately from the lock, because the potentially
4421-
* created multixact would otherwise be wrong.
4420+
* to be done separately from the combo that's going to be used for
4421+
* updating, because the potentially created multixact would otherwise
4422+
* be wrong.
44224423
*/
44234424
compute_new_xmax_infomask(HeapTupleGetRawXmax(&oldtup),
44244425
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
@@ -2210,9 +2210,6 @@ CommitTransaction(void)
22102210
smgrDoPendingDeletes(true);
22112211
}
22122212

2213-
/* Check we've released all catcache entries */
2214-
AtEOXact_CatCache(true);
2215-
22162213
AtCommit_Notify();
22172214
AtEOXact_GUC(true, s->gucNestLevel);
22182215
if (!is_autonomous_transaction)
@@ -2488,9 +2485,6 @@ PrepareTransaction(void)
24882485
*/
24892486
PostPrepare_Twophase();
24902487

2491-
/* Check we've released all catcache entries */
2492-
AtEOXact_CatCache(true);
2493-
24942488
/* PREPARE acts the same as COMMIT as far as GUC is concerned */
24952489
AtEOXact_GUC(true, 1);
24962490
AtEOXact_SPI(true);
@@ -2700,7 +2694,6 @@ AbortTransaction(void)
27002694
RESOURCE_RELEASE_AFTER_LOCKS,
27012695
false, true);
27022696
smgrDoPendingDeletes(false);
2703-
AtEOXact_CatCache(false);
27042697

27052698
AtEOXact_GUC(false, s->gucNestLevel);
27062699
AtEOXact_SPI(false);
@@ -4568,6 +4561,9 @@ AbortOutOfAnyTransaction(void)
45684561
{
45694562
TransactionState s = CurrentTransactionState;
45704563

4564+
/* Ensure we're not running in a doomed memory context */
4565+
AtAbort_Memory();
4566+
45714567
/*
45724568
* Get out of any transaction or nested transaction
45734569
*/
@@ -4609,7 +4605,14 @@ AbortOutOfAnyTransaction(void)
46094605
break;
46104606
case TBLOCK_ABORT:
46114607
case TBLOCK_ABORT_END:
4612-
/* AbortTransaction already done, still need Cleanup */
4608+
4609+
/*
4610+
* AbortTransaction is already done, still need Cleanup.
4611+
* However, if we failed partway through running ROLLBACK,
4612+
* there will be an active portal running that command, which
4613+
* we need to shut down before doing CleanupTransaction.
4614+
*/
4615+
AtAbort_Portals();
46134616
CleanupTransaction();
46144617
s->blockState = TBLOCK_DEFAULT;
46154618
break;
@@ -4632,6 +4635,14 @@ AbortOutOfAnyTransaction(void)
46324635
case TBLOCK_SUBABORT_END:
46334636
case TBLOCK_SUBABORT_RESTART:
46344637
/* As above, but AbortSubTransaction already done */
4638+
if (s->curTransactionOwner)
4639+
{
4640+
/* As in TBLOCK_ABORT, might have a live portal to zap */
4641+
AtSubAbort_Portals(s->subTransactionId,
4642+
s->parent->subTransactionId,
4643+
s->curTransactionOwner,
4644+
s->parent->curTransactionOwner);
4645+
}
46354646
CleanupSubTransaction();
46364647
s = CurrentTransactionState; /* changed by pop */
46374648
break;
@@ -4640,6 +4651,9 @@ AbortOutOfAnyTransaction(void)
46404651

46414652
/* Should be out of all subxacts now */
46424653
Assert(s->parent == NULL);
4654+
4655+
/* If we didn't actually have anything to do, revert to TopMemoryContext */
4656+
AtCleanup_Memory();
46434657
}
46444658

46454659
/*

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
@@ -4536,13 +4536,18 @@ ATTypedTableRecursion(List **wqueue, Relation rel, AlterTableCmd *cmd,
45364536
/*
45374537
* find_composite_type_dependencies
45384538
*
4539-
* Check to see if a composite type is being used as a column in some
4540-
* other table (possibly nested several levels deep in composite types!).
4539+
* Check to see if the type "typeOid" is being used as a column in some table
4540+
* (possibly nested several levels deep in composite types, arrays, etc!).
45414541
* Eventually, we'd like to propagate the check or rewrite operation
4542-
* into other such tables, but for now, just error out if we find any.
4542+
* into such tables, but for now, just error out if we find any.
45434543
*
4544-
* Caller should provide either a table name or a type name (not both) to
4545-
* report in the error message, if any.
4544+
* Caller should provide either the associated relation of a rowtype,
4545+
* or a type name (not both) for use in the error message, if any.
4546+
*
4547+
* Note that "typeOid" is not necessarily a composite type; it could also be
4548+
* another container type such as an array or range, or a domain over one of
4549+
* these things. The name of this function is therefore somewhat historical,
4550+
* but it's not worth changing.
45464551
*
45474552
* We assume that functions and views depending on the type are not reasons
45484553
* to reject the ALTER. (How safe is this really?)
@@ -4555,11 +4560,13 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
45554560
ScanKeyData key[2];
45564561
SysScanDesc depScan;
45574562
HeapTuple depTup;
4558-
Oid arrayOid;
4563+
4564+
/* since this function recurses, it could be driven to stack overflow */
4565+
check_stack_depth();
45594566

45604567
/*
4561-
* We scan pg_depend to find those things that depend on the rowtype. (We
4562-
* assume we can ignore refobjsubid for a rowtype.)
4568+
* We scan pg_depend to find those things that depend on the given type.
4569+
* (We assume we can ignore refobjsubid for a type.)
45634570
*/
45644571
depRel = heap_open(DependRelationId, AccessShareLock);
45654572

@@ -4581,8 +4588,22 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
45814588
Relation rel;
45824589
Form_pg_attribute att;
45834590

4584-
/* Ignore dependees that aren't user columns of relations */
4585-
/* (we assume system columns are never of rowtypes) */
4591+
/* Check for directly dependent types */
4592+
if (pg_depend->classid == TypeRelationId)
4593+
{
4594+
/*
4595+
* This must be an array, domain, or range containing the given
4596+
* type, so recursively check for uses of this type. Note that
4597+
* any error message will mention the original type not the
4598+
* container; this is intentional.
4599+
*/
4600+
find_composite_type_dependencies(pg_depend->objid,
4601+
origRelation, origTypeName);
4602+
continue;
4603+
}
4604+
4605+
/* Else, ignore dependees that aren't user columns of relations */
4606+
/* (we assume system columns are never of interesting types) */
45864607
if (pg_depend->classid != RelationRelationId ||
45874608
pg_depend->objsubid <= 0)
45884609
continue;
@@ -4638,14 +4659,6 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
46384659
systable_endscan(depScan);
46394660

46404661
relation_close(depRel, AccessShareLock);
4641-
4642-
/*
4643-
* If there's an array type for the rowtype, must check for uses of it,
4644-
* too.
4645-
*/
4646-
arrayOid = get_array_type(typeOid);
4647-
if (OidIsValid(arrayOid))
4648-
find_composite_type_dependencies(arrayOid, origRelation, origTypeName);
46494662
}
46504663

46514664

0 commit comments

Comments
 (0)