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

Commitd97e98e

Browse files
committed
Prevent psql from issuing BEGIN before ALTER SYSTEM when AUTOCOMMIT is off.
The autocommit-off mode works by issuing an implicit BEGIN just beforeany command that is not already in a transaction block and is not itselfa BEGIN or other transaction-control command, nor a command thatcannot be executed inside a transaction block. This commit prevents psqlfrom issuing such an implicit BEGIN before ALTER SYSTEM because it'snot allowed inside a transaction block.Backpatch to 9.4 where ALTER SYSTEM was added.Report by Feike Steenbergen
1 parentfbb1d7d commitd97e98e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎src/bin/psql/common.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,23 @@ command_no_begin(const char *query)
15241524
return false;
15251525
}
15261526

1527+
if (wordlen==5&&pg_strncasecmp(query,"alter",5)==0)
1528+
{
1529+
query+=wordlen;
1530+
1531+
query=skip_white_space(query);
1532+
1533+
wordlen=0;
1534+
while (isalpha((unsignedchar)query[wordlen]))
1535+
wordlen+=PQmblen(&query[wordlen],pset.encoding);
1536+
1537+
/* ALTER SYSTEM isn't allowed in xacts */
1538+
if (wordlen==6&&pg_strncasecmp(query,"system",6)==0)
1539+
return true;
1540+
1541+
return false;
1542+
}
1543+
15271544
/*
15281545
* Note: these tests will match DROP SYSTEM and REINDEX TABLESPACE, which
15291546
* aren't really valid commands so we don't care much. The other four

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp