Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42db6e4

Browse files
committed
Merge branch 'PGPRO9_5' into PGPRO9_5_phrase_search
2 parents68af452 +573ec82 commit42db6e4

File tree

8 files changed

+73
-14
lines changed

8 files changed

+73
-14
lines changed

‎doc/src/sgml/runtime.sgml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
183183
locale setting. For details see <xref linkend="multibyte">.
184184
</para>
185185

186+
<para>
187+
Non<literal>C</> and and non-<literal>POSIX</> locales rely on the
188+
operating system's collation library for character set ordering.
189+
This controls the ordering of keys stored in indexes. For this reason,
190+
a cluster cannot switch to an incompatible collation library version,
191+
either through snapshot restore, binary streaming replication, or
192+
<application>pg_upgrade</> run.
193+
</para>
194+
186195
<sect2 id="creating-cluster-mount-points">
187196
<title>Use of Secondary File Systems</title>
188197

‎src/backend/access/heap/ptrack.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,15 @@ ptrack_get_and_clear(Oid tablespace_oid, Oid table_oid)
277277
{
278278
bytea*result=NULL;
279279
BlockNumbernblock;
280+
Relationrel;
281+
280282
if (table_oid==InvalidOid)
281283
{
282284
elog(WARNING,"InvalidOid");
283285
gotofull_end;
284286
}
285-
Relationrel=RelationIdGetRelation(RelidByRelfilenode(tablespace_oid,
286-
table_oid));
287+
288+
rel=RelationIdGetRelation(RelidByRelfilenode(tablespace_oid,table_oid));
287289

288290
if (rel==InvalidRelation)
289291
{

‎src/backend/executor/execIndexing.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ ExecCloseIndices(ResultRelInfo *resultRelInfo)
260260
*the same is done for non-deferred constraints, but report
261261
*if conflict was speculative or deferred conflict to caller)
262262
*
263+
*If 'arbiterIndexes' is nonempty, noDupErr applies only to
264+
*those indexes. NIL means noDupErr applies to all indexes.
265+
*
263266
*CAUTION: this must not be called for a HOT update.
264267
*We can't defend against that here for lack of info.
265268
*Should we change the API to make it safer?
@@ -309,19 +312,15 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
309312
{
310313
RelationindexRelation=relationDescs[i];
311314
IndexInfo*indexInfo;
315+
boolapplyNoDupErr;
312316
IndexUniqueCheckcheckUnique;
313317
boolsatisfiesConstraint;
314-
boolarbiter;
315318

316319
if (indexRelation==NULL)
317320
continue;
318321

319322
indexInfo=indexInfoArray[i];
320323

321-
/* Record if speculative insertion arbiter */
322-
arbiter=list_member_oid(arbiterIndexes,
323-
indexRelation->rd_index->indexrelid);
324-
325324
/* If the index is marked as read-only, ignore it */
326325
if (!indexInfo->ii_ReadyForInserts)
327326
continue;
@@ -359,6 +358,12 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
359358
values,
360359
isnull);
361360

361+
/* Check whether to apply noDupErr to this index */
362+
applyNoDupErr=noDupErr&&
363+
(arbiterIndexes==NIL||
364+
list_member_oid(arbiterIndexes,
365+
indexRelation->rd_index->indexrelid));
366+
362367
/*
363368
* The index AM does the actual insertion, plus uniqueness checking.
364369
*
@@ -374,7 +379,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
374379
*/
375380
if (!indexRelation->rd_index->indisunique)
376381
checkUnique=UNIQUE_CHECK_NO;
377-
elseif (noDupErr&& (arbiterIndexes==NIL||arbiter))
382+
elseif (applyNoDupErr)
378383
checkUnique=UNIQUE_CHECK_PARTIAL;
379384
elseif (indexRelation->rd_index->indimmediate)
380385
checkUnique=UNIQUE_CHECK_YES;
@@ -408,7 +413,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
408413
boolviolationOK;
409414
CEOUC_WAIT_MODEwaitMode;
410415

411-
if (noDupErr)
416+
if (applyNoDupErr)
412417
{
413418
violationOK= true;
414419
waitMode=CEOUC_LIVELOCK_PREVENTING_WAIT;

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn)
897897
{
898898
ReorderBufferChange*cur_change;
899899

900-
if (txn->nentries!=txn->nentries_mem)
900+
if (cur_txn->nentries!=cur_txn->nentries_mem)
901901
ReorderBufferRestoreChanges(rb,cur_txn,
902902
&state->entries[off].fd,
903903
&state->entries[off].segno);

‎src/backend/utils/adt/ruleutils.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6050,7 +6050,8 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context)
60506050

60516051
tle=get_tle_by_resno(dpns->inner_tlist,var->varattno);
60526052
if (!tle)
6053-
elog(ERROR,"bogus varattno for subquery var: %d",var->varattno);
6053+
elog(ERROR,"invalid attnum %d for relation \"%s\"",
6054+
var->varattno,rte->eref->aliasname);
60546055

60556056
Assert(netlevelsup==0);
60566057
push_child_plan(dpns,dpns->inner_planstate,&save_dpns);
@@ -6111,9 +6112,13 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context)
61116112
elseif (attnum>0)
61126113
{
61136114
/* Get column name to use from the colinfo struct */
6114-
Assert(attnum <=colinfo->num_cols);
6115+
if (attnum>colinfo->num_cols)
6116+
elog(ERROR,"invalid attnum %d for relation \"%s\"",
6117+
attnum,rte->eref->aliasname);
61156118
attname=colinfo->colnames[attnum-1];
6116-
Assert(attname!=NULL);
6119+
if (attname==NULL)/* dropped column? */
6120+
elog(ERROR,"invalid attnum %d for relation \"%s\"",
6121+
attnum,rte->eref->aliasname);
61176122
}
61186123
else
61196124
{

‎src/backend/utils/time/snapmgr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,8 @@ RestoreSnapshot(char *start_address)
15731573
/* Copy SubXIDs, if present. */
15741574
if (serialized_snapshot->subxcnt>0)
15751575
{
1576-
snapshot->subxip=snapshot->xip+serialized_snapshot->xcnt;
1576+
snapshot->subxip= ((TransactionId*) (snapshot+1))+
1577+
serialized_snapshot->xcnt;
15771578
memcpy(snapshot->subxip,serialized_xids+serialized_snapshot->xcnt,
15781579
serialized_snapshot->subxcnt*sizeof(TransactionId));
15791580
}

‎src/test/regress/expected/insert_conflict.out

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,3 +702,26 @@ insert into dropcol(key, keep1, keep2) values(1, '5', 5) on conflict(key)
702702

703703
;
704704
DROP TABLE dropcol;
705+
-- check handling of regular btree constraint along with gist constraint
706+
create table twoconstraints (f1 int unique, f2 box,
707+
exclude using gist(f2 with &&));
708+
insert into twoconstraints values(1, '((0,0),(1,1))');
709+
insert into twoconstraints values(1, '((2,2),(3,3))'); -- fail on f1
710+
ERROR: duplicate key value violates unique constraint "twoconstraints_f1_key"
711+
DETAIL: Key (f1)=(1) already exists.
712+
insert into twoconstraints values(2, '((0,0),(1,2))'); -- fail on f2
713+
ERROR: conflicting key value violates exclusion constraint "twoconstraints_f2_excl"
714+
DETAIL: Key (f2)=((1,2),(0,0)) conflicts with existing key (f2)=((1,1),(0,0)).
715+
insert into twoconstraints values(2, '((0,0),(1,2))')
716+
on conflict on constraint twoconstraints_f1_key do nothing; -- fail on f2
717+
ERROR: conflicting key value violates exclusion constraint "twoconstraints_f2_excl"
718+
DETAIL: Key (f2)=((1,2),(0,0)) conflicts with existing key (f2)=((1,1),(0,0)).
719+
insert into twoconstraints values(2, '((0,0),(1,2))')
720+
on conflict on constraint twoconstraints_f2_excl do nothing; -- do nothing
721+
select * from twoconstraints;
722+
f1 | f2
723+
----+-------------
724+
1 | (1,1),(0,0)
725+
(1 row)
726+
727+
drop table twoconstraints;

‎src/test/regress/sql/insert_conflict.sql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,17 @@ insert into dropcol(key, keep1, keep2) values(1, '5', 5) on conflict(key)
407407
;
408408

409409
DROPTABLE dropcol;
410+
411+
-- check handling of regular btree constraint along with gist constraint
412+
413+
createtabletwoconstraints (f1int unique, f2box,
414+
exclude using gist(f2 with &&));
415+
insert into twoconstraintsvalues(1,'((0,0),(1,1))');
416+
insert into twoconstraintsvalues(1,'((2,2),(3,3))');-- fail on f1
417+
insert into twoconstraintsvalues(2,'((0,0),(1,2))');-- fail on f2
418+
insert into twoconstraintsvalues(2,'((0,0),(1,2))')
419+
on conflictonconstraint twoconstraints_f1_key do nothing;-- fail on f2
420+
insert into twoconstraintsvalues(2,'((0,0),(1,2))')
421+
on conflictonconstraint twoconstraints_f2_excl do nothing;-- do nothing
422+
select*from twoconstraints;
423+
droptable twoconstraints;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp