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

Commitbabdf37

Browse files
committed
Port ATX to 9.6 EE branch
1 parent308f763 commitbabdf37

File tree

43 files changed

+1140
-218
lines changed

Some content is hidden

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

43 files changed

+1140
-218
lines changed

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

Lines changed: 317 additions & 13 deletions
Large diffs are not rendered by default.

‎src/backend/commands/trigger.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5013,6 +5013,23 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
50135013
}
50145014
}
50155015

5016+
void*
5017+
TriggerSuspend(void)
5018+
{
5019+
AfterTriggersData*state=malloc(sizeof(AfterTriggersData));
5020+
*state=afterTriggers;
5021+
memset(&afterTriggers,0,sizeof(afterTriggers));
5022+
AfterTriggerBeginXact();
5023+
returnstate;
5024+
}
5025+
5026+
void
5027+
TriggerResume(void*state)
5028+
{
5029+
afterTriggers=*(AfterTriggersData*)state;
5030+
free(state);
5031+
}
5032+
50165033
Datum
50175034
pg_trigger_depth(PG_FUNCTION_ARGS)
50185035
{

‎src/backend/executor/spi.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ static int_SPI_stack_depth = 0;/* allocated size of _SPI_stack */
4747
staticint_SPI_connected=-1;
4848
staticint_SPI_curid=-1;
4949

50+
typedefstructSuspendedSPI
51+
{
52+
_SPI_connection*_SPI_stack;
53+
_SPI_connection*_SPI_current;
54+
int_SPI_stack_depth;
55+
int_SPI_connected;
56+
int_SPI_curid;
57+
}SuspendedSPI;
58+
5059
staticPortalSPI_cursor_open_internal(constchar*name,SPIPlanPtrplan,
5160
ParamListInfoparamLI,boolread_only);
5261

@@ -2731,3 +2740,32 @@ _SPI_save_plan(SPIPlanPtr plan)
27312740

27322741
returnnewplan;
27332742
}
2743+
2744+
#defineMOVELEFT(A,B,C) do { (A) = (B); } while (0)
2745+
void*
2746+
SuspendSPI(void)
2747+
{
2748+
SuspendedSPI*s=malloc(sizeof(SuspendedSPI));
2749+
2750+
MOVELEFT(s->_SPI_stack,_SPI_stack,NULL);
2751+
MOVELEFT(s->_SPI_current,_SPI_current,NULL);
2752+
MOVELEFT(s->_SPI_stack_depth,_SPI_stack_depth,0);
2753+
MOVELEFT(s->_SPI_connected,_SPI_connected,-1);
2754+
MOVELEFT(s->_SPI_curid,_SPI_curid,-1);
2755+
2756+
returns;
2757+
}
2758+
2759+
void
2760+
ResumeSPI(void*state)
2761+
{
2762+
SuspendedSPI*s= (SuspendedSPI*)state;
2763+
2764+
_SPI_stack=s->_SPI_stack;
2765+
_SPI_current=s->_SPI_current;
2766+
_SPI_stack_depth=s->_SPI_stack_depth;
2767+
_SPI_connected=s->_SPI_connected;
2768+
_SPI_curid=s->_SPI_curid;
2769+
2770+
free(state);
2771+
}

‎src/backend/parser/gram.y

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
409409
%type<list>opt_intervalinterval_second
410410
%type<node>overlay_placingsubstr_fromsubstr_for
411411

412+
%type<boolean>opt_autonomous
412413
%type<boolean>opt_instead
413414
%type<boolean>opt_uniqueopt_concurrentlyopt_verboseopt_full
414415
%type<boolean>opt_freezeopt_defaultopt_recheck
@@ -566,7 +567,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
566567
/* ordinary key words in alphabetical order*/
567568
%token<keyword>ABORT_PABSOLUTE_PACCESSACTIONADD_PADMINAFTER
568569
AGGREGATE ALL ALSO ALTER ALWAYS ANALYSE ANALYZE AND ANY APPLICATION ARRAY AS ASC
569-
ASSERTION ASSIGNMENT ASYMMETRIC AT ATTRIBUTE AUTHORIZATION
570+
ASSERTION ASSIGNMENT ASYMMETRIC AT ATTRIBUTE AUTHORIZATION AUTONOMOUS
570571

571572
BACKWARD BEFORE BEGIN_P BETWEEN BIGINT BINARY BIT
572573
BOOLEAN_P BOTH BY
@@ -8697,18 +8698,28 @@ TransactionStmt:
86978698
n->options = NIL;
86988699
$$ = (Node *)n;
86998700
}
8700-
|BEGIN_Popt_transactiontransaction_mode_list_or_empty
8701+
|ABORT_PAUTONOMOUSTRANSACTION
8702+
{
8703+
TransactionStmt *n = makeNode(TransactionStmt);
8704+
n->kind = TRANS_STMT_ROLLBACK;
8705+
n->autonomous =true;
8706+
n->options = NIL;
8707+
$$ = (Node *)n;
8708+
}
8709+
|BEGIN_Popt_autonomousopt_transactiontransaction_mode_list_or_empty
87018710
{
87028711
TransactionStmt *n = makeNode(TransactionStmt);
87038712
n->kind = TRANS_STMT_BEGIN;
8704-
n->options =$3;
8713+
n->autonomous =$2;
8714+
n->options =$4;
87058715
$$ = (Node *)n;
87068716
}
8707-
|STARTTRANSACTIONtransaction_mode_list_or_empty
8717+
|STARTopt_autonomousTRANSACTIONtransaction_mode_list_or_empty
87088718
{
87098719
TransactionStmt *n = makeNode(TransactionStmt);
87108720
n->kind = TRANS_STMT_START;
8711-
n->options =$3;
8721+
n->autonomous =$2;
8722+
n->options =$4;
87128723
$$ = (Node *)n;
87138724
}
87148725
|COMMITopt_transaction
@@ -8718,20 +8729,44 @@ TransactionStmt:
87188729
n->options = NIL;
87198730
$$ = (Node *)n;
87208731
}
8732+
|COMMITAUTONOMOUSTRANSACTION
8733+
{
8734+
TransactionStmt *n = makeNode(TransactionStmt);
8735+
n->kind = TRANS_STMT_COMMIT;
8736+
n->autonomous =true;
8737+
n->options = NIL;
8738+
$$ = (Node *)n;
8739+
}
87218740
|END_Popt_transaction
87228741
{
87238742
TransactionStmt *n = makeNode(TransactionStmt);
87248743
n->kind = TRANS_STMT_COMMIT;
87258744
n->options = NIL;
87268745
$$ = (Node *)n;
87278746
}
8747+
|END_PAUTONOMOUSTRANSACTION
8748+
{
8749+
TransactionStmt *n = makeNode(TransactionStmt);
8750+
n->kind = TRANS_STMT_COMMIT;
8751+
n->autonomous =true;
8752+
n->options = NIL;
8753+
$$ = (Node *)n;
8754+
}
87288755
|ROLLBACKopt_transaction
87298756
{
87308757
TransactionStmt *n = makeNode(TransactionStmt);
87318758
n->kind = TRANS_STMT_ROLLBACK;
87328759
n->options = NIL;
87338760
$$ = (Node *)n;
87348761
}
8762+
|ROLLBACKAUTONOMOUSTRANSACTION
8763+
{
8764+
TransactionStmt *n = makeNode(TransactionStmt);
8765+
n->kind = TRANS_STMT_ROLLBACK;
8766+
n->autonomous =true;
8767+
n->options = NIL;
8768+
$$ = (Node *)n;
8769+
}
87358770
|SAVEPOINTColId
87368771
{
87378772
TransactionStmt *n = makeNode(TransactionStmt);
@@ -8800,6 +8835,11 @@ opt_transaction:WORK{}
88008835
|/*EMPTY*/{}
88018836
;
88028837

8838+
opt_autonomous:
8839+
AUTONOMOUS{$$ =TRUE; }
8840+
|/*EMPTY*/{$$ =FALSE; }
8841+
;
8842+
88038843
transaction_mode_item:
88048844
ISOLATIONLEVELiso_level
88058845
{$$ = makeDefElem("transaction_isolation",
@@ -14136,6 +14176,7 @@ col_name_keyword:
1413614176
*/
1413714177
type_func_name_keyword:
1413814178
AUTHORIZATION
14179+
| AUTONOMOUS
1413914180
| BINARY
1414014181
| COLLATION
1414114182
| CONCURRENTLY

‎src/backend/postmaster/pgstat.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5536,3 +5536,40 @@ pgstat_db_requested(Oid databaseid)
55365536

55375537
return false;
55385538
}
5539+
5540+
typedefstruct {
5541+
PgStat_SubXactStatus*pgStatXactStack;
5542+
intpgStatXactCommit;
5543+
intpgStatXactRollback;
5544+
PgStat_CounterpgStatBlockReadTime;
5545+
PgStat_CounterpgStatBlockWriteTime;
5546+
}SuspendedPgStat;
5547+
5548+
#defineMOVELEFT(A,B,C) do { (A) = (B); (B) = (C); } while (0)
5549+
void*
5550+
PgStatSuspend(void)
5551+
{
5552+
SuspendedPgStat*sus=malloc(sizeof(SuspendedPgStat));
5553+
5554+
MOVELEFT(sus->pgStatXactStack,pgStatXactStack,NULL);
5555+
MOVELEFT(sus->pgStatXactCommit,pgStatXactCommit,0);
5556+
MOVELEFT(sus->pgStatXactRollback,pgStatXactRollback,0);
5557+
MOVELEFT(sus->pgStatBlockReadTime,pgStatBlockReadTime,0);
5558+
MOVELEFT(sus->pgStatBlockWriteTime,pgStatBlockWriteTime,0);
5559+
5560+
returnsus;
5561+
}
5562+
5563+
void
5564+
PgStatResume(void*src)
5565+
{
5566+
SuspendedPgStat*sus= (SuspendedPgStat*)src;
5567+
5568+
pgStatXactStack=sus->pgStatXactStack;
5569+
pgStatXactCommit=sus->pgStatXactCommit;
5570+
pgStatXactRollback=sus->pgStatXactRollback;
5571+
pgStatBlockReadTime=sus->pgStatBlockReadTime;
5572+
pgStatBlockWriteTime=sus->pgStatBlockWriteTime;
5573+
5574+
free(src);
5575+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp