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

Commitfa0e318

Browse files
committed
Fix overly-strict sanity check in BeginInternalSubTransaction that made it
fail when used in a deferred trigger. Bug goes back to 8.0; no doubt thereason it hadn't been noticed is that we've been discouraging use ofuser-defined constraint triggers. Per report from Frank van Vugt.
1 parent9b89c13 commitfa0e318

File tree

1 file changed

+8
-7
lines changed
  • src/backend/access/transam

1 file changed

+8
-7
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.243 2007/05/27 03:50:39 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.244 2007/05/30 21:01:39 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -3348,10 +3348,11 @@ RollbackToSavepoint(List *options)
33483348

33493349
/*
33503350
* BeginInternalSubTransaction
3351-
*This is the same as DefineSavepoint except it allows TBLOCK_STARTED
3352-
*state, and therefore it can safely be used in a function that might
3353-
*be called when not inside a BEGIN block. Also, we automatically
3354-
*cycle through CommitTransactionCommand/StartTransactionCommand
3351+
*This is the same as DefineSavepoint except it allows TBLOCK_STARTED,
3352+
*TBLOCK_END, and TBLOCK_PREPARE states, and therefore it can safely be
3353+
*used in functions that might be called when not inside a BEGIN block
3354+
*or when running deferred triggers at COMMIT/PREPARE time. Also, it
3355+
*automatically does CommitTransactionCommand/StartTransactionCommand
33553356
*instead of expecting the caller to do it.
33563357
*/
33573358
void
@@ -3363,6 +3364,8 @@ BeginInternalSubTransaction(char *name)
33633364
{
33643365
caseTBLOCK_STARTED:
33653366
caseTBLOCK_INPROGRESS:
3367+
caseTBLOCK_END:
3368+
caseTBLOCK_PREPARE:
33663369
caseTBLOCK_SUBINPROGRESS:
33673370
/* Normal subtransaction start */
33683371
PushTransaction();
@@ -3380,7 +3383,6 @@ BeginInternalSubTransaction(char *name)
33803383
caseTBLOCK_DEFAULT:
33813384
caseTBLOCK_BEGIN:
33823385
caseTBLOCK_SUBBEGIN:
3383-
caseTBLOCK_END:
33843386
caseTBLOCK_SUBEND:
33853387
caseTBLOCK_ABORT:
33863388
caseTBLOCK_SUBABORT:
@@ -3390,7 +3392,6 @@ BeginInternalSubTransaction(char *name)
33903392
caseTBLOCK_SUBABORT_PENDING:
33913393
caseTBLOCK_SUBRESTART:
33923394
caseTBLOCK_SUBABORT_RESTART:
3393-
caseTBLOCK_PREPARE:
33943395
elog(FATAL,"BeginInternalSubTransaction: unexpected state %s",
33953396
BlockStateAsString(s->blockState));
33963397
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp