Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ad4ce7aa
Commit
ad4ce7aa
authored
Oct 13, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make SET really not start a transaction.
parent
5261bf97
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
41 deletions
+40
-41
doc/src/sgml/ref/reset.sgml
doc/src/sgml/ref/reset.sgml
+2
-2
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/set.sgml
+4
-3
doc/src/sgml/ref/show.sgml
doc/src/sgml/ref/show.sgml
+8
-1
doc/src/sgml/runtime.sgml
doc/src/sgml/runtime.sgml
+8
-8
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+18
-27
No files found.
doc/src/sgml/ref/reset.sgml
View file @
ad4ce7aa
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/reset.sgml,v 1.1
6 2002/10/09 04:59:38 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/reset.sgml,v 1.1
7 2002/10/13 16:55:05 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -68,7 +68,7 @@ SET <replaceable class="parameter">variable</replaceable> TO DEFAULT
</para>
<para>
See the <command>S
HOW
</> manual page for details on the transaction
See the <command>S
ET
</> manual page for details on the transaction
behavior of <command>RESET</>.
</para>
...
...
doc/src/sgml/ref/set.sgml
View file @
ad4ce7aa
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.6
7 2002/10/09 16:27:48 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.6
8 2002/10/13 16:55:05 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -109,9 +109,10 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="PARAMETER">timezone</rep
</para>
<para>
W
ith <literal>autocommit</> set to <literal>off</>, <command>SET</>
Even w
ith <literal>autocommit</> set to <literal>off</>, <command>SET</>
does not start a new transaction block. See the
<literal>autocommit</> section of the documentation for details.
<literal>autocommit</> section of the <citetitle>Administrator's
Guide</citetitle> for details.
</para>
<para>
...
...
doc/src/sgml/ref/show.sgml
View file @
ad4ce7aa
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.2
1 2002/09/01 01:59:48 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/show.sgml,v 1.2
2 2002/10/13 16:55:05 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -60,6 +60,13 @@ SHOW ALL
command-line flag when starting the
<application>postmaster</application>.
</para>
<para>
Even with <literal>autocommit</> set to <literal>off</>, <command>SHOW</>
does not start a new transaction block. See the
<literal>autocommit</> section of the <citetitle>Administrator's
Guide</citetitle> for details.
</para>
</refsect1>
<refsect1>
...
...
doc/src/sgml/runtime.sgml
View file @
ad4ce7aa
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.14
4 2002/10/09 04:59:38 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.14
5 2002/10/13 16:55:05 tgl
Exp $
-->
<Chapter Id="runtime">
...
...
@@ -1236,7 +1236,7 @@ env PGOPTIONS='-c geqo=off' psql
<command>BEGIN</> with no matching <command>COMMIT</> has been
given).
If set to false, <productname>PostgreSQL</productname> will
commit
the commands only whe
n receiving an explicit
commit
only upo
n receiving an explicit
<command>COMMIT</> command. This mode can also be thought of as
implicitly issuing <command>BEGIN</> whenever a command is
received that is not already inside a transaction block. The
...
...
@@ -1247,16 +1247,16 @@ env PGOPTIONS='-c geqo=off' psql
</para>
<note>
<para>
W
ith <varname>autocommit</> set to false, <command>SET</>,
Even w
ith <varname>autocommit</> set to false, <command>SET</>,
<command>SHOW</>, and <command>RESET</> do not start new
transaction blocks. They are run in their own transactions.
Once another command is issued,
multi-statement transaction
be
havior be
gins and any <command>SET</>, <command>SHOW</>, or
Once another command is issued,
a transaction block
begins and any <command>SET</>, <command>SHOW</>, or
<command>RESET</> commands are considered to be part of the
transaction, i.e. they are committed or rolled back depending
on the completion status of the transaction. To
have
<command>SET</>, <command>SHOW</>,
and
<command>RESET</>
command
s at the start of a transaction
, use <command>BEGIN</>
on the completion status of the transaction. To
execute a
<command>SET</>, <command>SHOW</>,
or
<command>RESET</>
command
at the start of a transaction block
, use <command>BEGIN</>
first.
</para>
</note>
...
...
src/backend/tcop/postgres.c
View file @
ad4ce7aa
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.30
0 2002/10/09 04:59:38 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.30
1 2002/10/13 16:55:05 tgl
Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -76,7 +76,6 @@ char *debug_query_string; /* for pgmonitor and
CommandDest
whereToSendOutput
=
Debug
;
extern
int
StatementTimeout
;
extern
bool
autocommit
;
static
bool
dontExecute
=
false
;
...
...
@@ -620,15 +619,11 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
foreach
(
parsetree_item
,
parsetree_list
)
{
Node
*
parsetree
=
(
Node
*
)
lfirst
(
parsetree_item
);
bool
isTransactionStmt
;
const
char
*
commandTag
;
char
completionTag
[
COMPLETION_TAG_BUFSIZE
];
List
*
querytree_list
,
*
querytree_item
;
/* Transaction control statements need some special handling */
isTransactionStmt
=
IsA
(
parsetree
,
TransactionStmt
);
/*
* First we set the command-completion tag to the main query (as
* opposed to each of the others that may be generated by analyze
...
...
@@ -653,7 +648,7 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
{
bool
allowit
=
false
;
if
(
isTransactionStmt
)
if
(
IsA
(
parsetree
,
TransactionStmt
)
)
{
TransactionStmt
*
stmt
=
(
TransactionStmt
*
)
parsetree
;
...
...
@@ -698,6 +693,7 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
foreach
(
querytree_item
,
querytree_list
)
{
Query
*
querytree
=
(
Query
*
)
lfirst
(
querytree_item
);
bool
endTransactionBlock
=
false
;
/* Make sure we are in a transaction command */
if
(
!
xact_started
)
...
...
@@ -733,6 +729,13 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
IsA
(
utilityStmt
,
ReindexStmt
))
SetQuerySnapshot
();
/* end transaction block if transaction or variable stmt */
if
(
IsA
(
utilityStmt
,
TransactionStmt
)
||
IsA
(
utilityStmt
,
VariableSetStmt
)
||
IsA
(
utilityStmt
,
VariableShowStmt
)
||
IsA
(
utilityStmt
,
VariableResetStmt
))
endTransactionBlock
=
true
;
if
(
querytree
->
originalQuery
)
{
/* utility statement can override default tag string */
...
...
@@ -805,7 +808,7 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
* visible to subsequent ones. In particular we'd better do
* so before checking constraints.
*/
if
(
!
isTransactionStmt
)
if
(
!
endTransactionBlock
)
CommandCounterIncrement
();
/*
...
...
@@ -820,13 +823,13 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
MemoryContextResetAndDeleteChildren
(
CurrentMemoryContext
);
/*
* If this was a transaction control statement
, commit it and
*
arrange to start a new xact command for the next command
* (if any).
* If this was a transaction control statement
or a variable
*
set/show/reset statement, commit it and arrange to start a
*
new xact command for the next command
(if any).
*/
if
(
isTransactionStmt
)
if
(
endTransactionBlock
)
{
finish_xact_command
(
fals
e
);
finish_xact_command
(
tru
e
);
xact_started
=
false
;
}
}
/* end loop over queries generated from a
...
...
@@ -844,19 +847,7 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
*/
if
(
lnext
(
parsetree_item
)
==
NIL
&&
xact_started
)
{
/*
* Don't allow SET/SHOW/RESET to start a new transaction
* with autocommit off. We do this by forcing a COMMIT
* when these commands start a transaction.
*/
if
(
autocommit
||
IsTransactionState
()
||
(
strcmp
(
commandTag
,
"SET"
)
!=
0
&&
strcmp
(
commandTag
,
"SHOW"
)
!=
0
&&
strcmp
(
commandTag
,
"RESET"
)
!=
0
))
finish_xact_command
(
false
);
else
finish_xact_command
(
true
);
xact_started
=
false
;
}
...
...
@@ -1733,7 +1724,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
!
IsUnderPostmaster
)
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.30
0 $ $Date: 2002/10/09 04:59:38
$
\n
"
);
puts
(
"$Revision: 1.30
1 $ $Date: 2002/10/13 16:55:05
$
\n
"
);
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment