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

Commit8670e35

Browse files
committed
Prevent multiple queries in a single string into a single transaction
when autocommit is off, and document grouping when autocommit is on.
1 parentd258ba0 commit8670e35

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

‎doc/src/sgml/libpq.sgml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.114 2003/03/22 03:29:05 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.115 2003/03/24 18:33:52 momjian Exp $
33
-->
44

55
<chapter id="libpq">
@@ -857,11 +857,8 @@ returned by the server.
857857
maintain the <structname>PGresult</structname> abstraction. Use the accessor functions below to get
858858
at the contents of <structname>PGresult</structname>. Avoid directly referencing the fields of the
859859
<structname>PGresult</structname> structure because they are subject to change in the future.
860-
(Beginning in <productname>PostgreSQL</productname> 6.4, the
861-
definition of <type>struct</> behind <structname>PGresult</> is not even provided in <filename>libpq-fe.h</>. If you
862-
have old code that accesses <structname>PGresult</structname> fields directly, you can keep using it
863-
by including <filename>libpq-int.h</filename> too, but you are encouraged to fix the code
864-
soon.)
860+
If <quote>autocommit</quote> is on, multiple queries sent in a single
861+
function call are processed in a single transaction.
865862
</para>
866863

867864
<variablelist>

‎doc/src/sgml/ref/psql-ref.sgml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.86 2003/03/2414:32:51 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.87 2003/03/2418:33:52 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -86,6 +86,11 @@ PostgreSQL documentation
8686
meta-commands. To achieve that, you could pipe the string into
8787
<application>psql</application>, like this: <literal>echo "\x \\
8888
select * from foo;" | psql</literal>.
89+
</para>
90+
<para>
91+
If <quote>autocommit</quote> is on, multiple queries in a single
92+
string are processed in a single transaction.
93+
8994
</para>
9095
</listitem>
9196
</varlistentry>

‎src/backend/tcop/postgres.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.319 2003/03/22 04:23:34 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.320 2003/03/24 18:33:52 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -83,6 +83,8 @@ sigjmp_bufWarn_restart;
8383
boolWarn_restart_ready= false;
8484
boolInError= false;
8585

86+
externboolautocommit;
87+
8688
staticboolEchoQuery= false;/* default don't echo */
8789

8890
/*
@@ -893,7 +895,7 @@ pg_exec_query_string(StringInfo query_string,/* string to execute */
893895
* historical Postgres behavior, we do not force a transaction
894896
* boundary between queries appearing in a single query string.
895897
*/
896-
if (lnext(parsetree_item)==NIL&&xact_started)
898+
if ((lnext(parsetree_item)==NIL|| !autocommit)&&xact_started)
897899
{
898900
finish_xact_command(false);
899901
xact_started= false;
@@ -1793,7 +1795,7 @@ PostgresMain(int argc, char *argv[], const char *username)
17931795
if (!IsUnderPostmaster)
17941796
{
17951797
puts("\nPOSTGRES backend interactive interface ");
1796-
puts("$Revision: 1.319 $ $Date: 2003/03/22 04:23:34 $\n");
1798+
puts("$Revision: 1.320 $ $Date: 2003/03/24 18:33:52 $\n");
17971799
}
17981800

17991801
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp