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

Commita2597ef

Browse files
committed
Modify sequence state storage to eliminate dangling-pointer problem
exemplified by bug #671. Moving the storage to relcache turned out tobe a bad idea because relcache might decide to discard the info. Instead,open and close the relcache entry on each sequence operation, and usea record of the current XID to discover whether we already holdAccessShareLock on the sequence.
1 parentb8ffc99 commita2597ef

File tree

5 files changed

+153
-139
lines changed

5 files changed

+153
-139
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.123 2002/05/21 22:05:53 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.124 2002/05/22 21:40:55 tgl Exp $
1212
*
1313
* NOTES
1414
*Transaction aborts can now occur two ways:
@@ -166,7 +166,6 @@
166166
#include"catalog/index.h"
167167
#include"catalog/namespace.h"
168168
#include"commands/async.h"
169-
#include"commands/sequence.h"
170169
#include"commands/trigger.h"
171170
#include"executor/spi.h"
172171
#include"libpq/be-fsstubs.h"
@@ -947,7 +946,6 @@ CommitTransaction(void)
947946
/* NOTIFY commit must also come before lower-level cleanup */
948947
AtCommit_Notify();
949948

950-
CloseSequences();
951949
AtEOXact_portals();
952950

953951
/* Here is where we really truly commit. */
@@ -1063,7 +1061,6 @@ AbortTransaction(void)
10631061
DeferredTriggerAbortXact();
10641062
lo_commit(false);/* 'false' means it's abort */
10651063
AtAbort_Notify();
1066-
CloseSequences();
10671064
AtEOXact_portals();
10681065

10691066
/* Advertise the fact that we aborted in pg_clog. */

‎src/backend/commands/define.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.76 2002/04/15 05:22:03 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.77 2002/05/22 21:40:55 tgl Exp $
1313
*
1414
* DESCRIPTION
1515
* The "DefineFoo" routines take the parse tree and pick out the
@@ -37,6 +37,7 @@
3737

3838
#include"commands/defrem.h"
3939
#include"parser/parse_type.h"
40+
#include"utils/int8.h"
4041

4142

4243
/*
@@ -114,6 +115,34 @@ defGetNumeric(DefElem *def)
114115
return0;/* keep compiler quiet */
115116
}
116117

118+
/*
119+
* Extract an int64 value from a DefElem.
120+
*/
121+
int64
122+
defGetInt64(DefElem*def)
123+
{
124+
if (def->arg==NULL)
125+
elog(ERROR,"Define: \"%s\" requires a numeric value",
126+
def->defname);
127+
switch (nodeTag(def->arg))
128+
{
129+
caseT_Integer:
130+
return (int64)intVal(def->arg);
131+
caseT_Float:
132+
/*
133+
* Values too large for int4 will be represented as Float
134+
* constants by the lexer. Accept these if they are valid int8
135+
* strings.
136+
*/
137+
returnDatumGetInt64(DirectFunctionCall1(int8in,
138+
CStringGetDatum(strVal(def->arg))));
139+
default:
140+
elog(ERROR,"Define: \"%s\" requires a numeric value",
141+
def->defname);
142+
}
143+
return0;/* keep compiler quiet */
144+
}
145+
117146
/*
118147
* Extract a possibly-qualified name (as a List of Strings) from a DefElem.
119148
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp