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

Commit5fc889f

Browse files
committed
Hmm, guess I forgot to commit this file the other day ...
just some cosmetic changes now, Vadim already fixed the heap_xxx calls.
1 parent82b1f55 commit5fc889f

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

‎src/backend/tcop/utility.c

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.68 1999/09/29 16:06:11 wieck Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.69 1999/09/30 01:12:36 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -206,35 +206,30 @@ ProcessUtility(Node *parsetree,
206206
}
207207
break;
208208

209-
caseT_TruncateStmt:
210-
{
209+
caseT_TruncateStmt:
210+
{
211+
Relationrel;
211212

212-
Relationrel;
213+
PS_SET_STATUS(commandTag="TRUNCATE");
214+
CHECK_IF_ABORTED();
213215

214-
PS_SET_STATUS(commandTag="TRUNCATE");
215-
CHECK_IF_ABORTED();
216+
relname= ((TruncateStmt*)parsetree)->relName;
217+
if (!allowSystemTableMods&&IsSystemRelationName(relname))
218+
elog(ERROR,"TRUNCATE cannot be used on system tables. '%s' is a system table",
219+
relname);
216220

217-
relname= ((TruncateStmt*)parsetree)->relName;
218-
if (!allowSystemTableMods&&IsSystemRelationName(relname)) {
219-
elog(ERROR,"TRUNCATE cannot be used on system tables. '%s' is a system table",
220-
relname);
221-
}
222-
223-
rel=heap_openr(relname,AccessExclusiveLock);
224-
if (RelationIsValid(rel)) {
225-
if (rel->rd_rel->relkind==RELKIND_SEQUENCE) {
226-
elog(ERROR,"TRUNCATE cannot be used on sequences. '%s' is a sequence",
227-
relname);
228-
}
221+
/* Grab exclusive lock in preparation for truncate... */
222+
rel=heap_openr(relname,AccessExclusiveLock);
223+
if (rel->rd_rel->relkind==RELKIND_SEQUENCE)
224+
elog(ERROR,"TRUNCATE cannot be used on sequences. '%s' is a sequence",
225+
relname);
229226
heap_close(rel,NoLock);
230-
}
227+
231228
#ifndefNO_SECURITY
232-
if (!pg_ownercheck(userName,relname,RELNAME)) {
233-
elog(ERROR,"you do not own class \"%s\"",relname);
234-
}
229+
if (!pg_ownercheck(userName,relname,RELNAME))
230+
elog(ERROR,"you do not own class \"%s\"",relname);
235231
#endif
236-
TruncateRelation(((TruncateStmt*)parsetree)->relName);
237-
232+
TruncateRelation(relname);
238233
}
239234
break;
240235

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp