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
896bd121
Commit
896bd121
authored
Dec 30, 2002
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code review for transaction-safe-TRUNCATE patch: minor cleanups.
parent
a03c0d93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
doc/src/sgml/release.sgml
doc/src/sgml/release.sgml
+2
-1
src/backend/commands/cluster.c
src/backend/commands/cluster.c
+10
-4
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+7
-3
No files found.
doc/src/sgml/release.sgml
View file @
896bd121
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.17
3 2002/12/20 00:24:00 momjian
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.17
4 2002/12/30 19:45:11 tgl
Exp $
-->
-->
<appendix id="release">
<appendix id="release">
...
@@ -29,6 +29,7 @@ Information schema
...
@@ -29,6 +29,7 @@ Information schema
Domains now support CHECK constraints
Domains now support CHECK constraints
psql backslash commands for listing conversions, casts, and schemas
psql backslash commands for listing conversions, casts, and schemas
TRUNCATE TABLE is transaction-safe
TRUNCATE TABLE is transaction-safe
CLUSTER can re-cluster a previously clustered table, or all such tables
Statement-level triggers
Statement-level triggers
System can use either hash- or sort-based strategy for grouped aggregation
System can use either hash- or sort-based strategy for grouped aggregation
ON COMMIT options for temp tables
ON COMMIT options for temp tables
...
...
src/backend/commands/cluster.c
View file @
896bd121
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.10
3 2002/12/30 18:42:13
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.10
4 2002/12/30 19:45:15
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
#include "catalog/index.h"
#include "catalog/index.h"
#include "catalog/indexing.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/namespace.h"
#include "catalog/pg_constraint.h"
#include "commands/cluster.h"
#include "commands/cluster.h"
#include "commands/tablecmds.h"
#include "commands/tablecmds.h"
#include "miscadmin.h"
#include "miscadmin.h"
...
@@ -111,9 +110,9 @@ cluster(ClusterStmt *stmt)
...
@@ -111,9 +110,9 @@ cluster(ClusterStmt *stmt)
RelToCluster
rvtc
;
RelToCluster
rvtc
;
/* Find and lock the table */
/* Find and lock the table */
tableOid
=
RangeVarGetRelid
(
stmt
->
relation
,
false
);
rel
=
heap_openrv
(
stmt
->
relation
,
AccessExclusiveLock
);
rel
=
heap_open
(
tableOid
,
AccessExclusiveLock
);
tableOid
=
RelationGetRelid
(
rel
);
/* Check permissions */
/* Check permissions */
if
(
!
check_cluster_permitted
(
tableOid
))
if
(
!
check_cluster_permitted
(
tableOid
))
...
@@ -325,6 +324,13 @@ cluster_rel(RelToCluster *rvtc, bool recheck)
...
@@ -325,6 +324,13 @@ cluster_rel(RelToCluster *rvtc, bool recheck)
elog
(
ERROR
,
"CLUSTER: cannot cluster system relation
\"
%s
\"
"
,
elog
(
ERROR
,
"CLUSTER: cannot cluster system relation
\"
%s
\"
"
,
RelationGetRelationName
(
OldHeap
));
RelationGetRelationName
(
OldHeap
));
/*
* Don't allow cluster on temp tables of other backends ... their
* local buffer manager is not going to cope.
*/
if
(
isOtherTempNamespace
(
RelationGetNamespace
(
OldHeap
)))
elog
(
ERROR
,
"CLUSTER cannot be used on temp tables of other processes"
);
/* Drop relcache refcnt on OldIndex, but keep lock */
/* Drop relcache refcnt on OldIndex, but keep lock */
index_close
(
OldIndex
);
index_close
(
OldIndex
);
...
...
src/backend/commands/tablecmds.c
View file @
896bd121
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.6
3 2002/12/30 18:42:14
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.6
4 2002/12/30 19:45:17
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -423,8 +423,7 @@ TruncateRelation(const RangeVar *relation)
...
@@ -423,8 +423,7 @@ TruncateRelation(const RangeVar *relation)
Form_pg_constraint
con
=
(
Form_pg_constraint
)
GETSTRUCT
(
tuple
);
Form_pg_constraint
con
=
(
Form_pg_constraint
)
GETSTRUCT
(
tuple
);
if
(
con
->
contype
==
'f'
&&
con
->
conrelid
!=
relid
)
if
(
con
->
contype
==
'f'
&&
con
->
conrelid
!=
relid
)
elog
(
ERROR
,
"TRUNCATE cannot be used as table %s references "
elog
(
ERROR
,
"TRUNCATE cannot be used as table %s references this one via foreign key constraint %s"
,
"this one via foreign key constraint %s"
,
get_rel_name
(
con
->
conrelid
),
get_rel_name
(
con
->
conrelid
),
NameStr
(
con
->
conname
));
NameStr
(
con
->
conname
));
}
}
...
@@ -439,6 +438,11 @@ TruncateRelation(const RangeVar *relation)
...
@@ -439,6 +438,11 @@ TruncateRelation(const RangeVar *relation)
rebuild_relation
(
rel
,
InvalidOid
);
rebuild_relation
(
rel
,
InvalidOid
);
/* NB: rebuild_relation does heap_close() */
/* NB: rebuild_relation does heap_close() */
/*
* You might think we need to truncate the rel's toast table here too,
* but actually we don't; it will have been rebuilt in an empty state.
*/
}
}
/*----------
/*----------
...
...
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