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
49ce6fff
Commit
49ce6fff
authored
Jun 18, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow removal of system-named pg_* temp tables. Rename temp file/dir as
pgsql_tmp.
parent
0bba6bdb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
47 deletions
+51
-47
src/backend/catalog/aclchk.c
src/backend/catalog/aclchk.c
+3
-2
src/backend/catalog/heap.c
src/backend/catalog/heap.c
+35
-39
src/backend/storage/file/fd.c
src/backend/storage/file/fd.c
+3
-3
src/backend/tcop/utility.c
src/backend/tcop/utility.c
+4
-2
src/include/utils/temprel.h
src/include/utils/temprel.h
+6
-1
No files found.
src/backend/catalog/aclchk.c
View file @
49ce6fff
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.5
0 2001/06/09 23:21:54 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.5
1 2001/06/18 16:13:21 momjian
Exp $
*
* NOTES
* See acl.h.
...
...
@@ -32,6 +32,7 @@
#include "parser/parse_func.h"
#include "utils/acl.h"
#include "utils/syscache.h"
#include "utils/temprel.h"
static
int32
aclcheck
(
Acl
*
acl
,
AclId
id
,
AclIdType
idtype
,
AclMode
mode
);
...
...
@@ -437,7 +438,7 @@ pg_aclcheck(char *relname, Oid userid, AclMode mode)
*/
if
((
mode
&
(
ACL_INSERT
|
ACL_UPDATE
|
ACL_DELETE
))
&&
!
allowSystemTableMods
&&
IsSystemRelationName
(
relname
)
&&
strncmp
(
relname
,
"pg_temp."
,
strlen
(
"pg_temp."
))
!=
0
&&
!
is_temp_relname
(
relname
)
&&
!
((
Form_pg_shadow
)
GETSTRUCT
(
tuple
))
->
usecatupd
)
{
#ifdef ACLDEBUG
...
...
src/backend/catalog/heap.c
View file @
49ce6fff
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.16
7 2001/06/12 05:55:49 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.16
8 2001/06/18 16:13:21 momjian
Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -281,8 +281,8 @@ heap_create(char *relname,
* replace relname of caller with a unique name for a temp
* relation
*/
snprintf
(
relname
,
NAMEDATALEN
,
"
pg_temp.%d.
%u"
,
(
int
)
MyProcPid
,
uniqueId
++
);
snprintf
(
relname
,
NAMEDATALEN
,
"
%s_%d_
%u"
,
PG_TEMP_REL_PREFIX
,
(
int
)
MyProcPid
,
uniqueId
++
);
}
/*
...
...
@@ -874,37 +874,6 @@ heap_create_with_catalog(char *relname,
}
/* ----------------------------------------------------------------
* heap_drop_with_catalog - removes all record of named relation from catalogs
*
* 1) open relation, check for existence, etc.
* 2) remove inheritance information
* 3) remove indexes
* 4) remove pg_class tuple
* 5) remove pg_attribute tuples and related descriptions
* 6) remove pg_description tuples
* 7) remove pg_type tuples
* 8) RemoveConstraints ()
* 9) unlink relation
*
* old comments
* Except for vital relations, removes relation from
* relation catalog, and related attributes from
* attribute catalog (needed?). (Anything else?)
*
* get proper relation from relation catalog (if not arg)
* scan attribute catalog deleting attributes of reldesc
* (necessary?)
* delete relation from relation catalog
* (How are the tuples of the relation discarded?)
*
* XXX Must fix to work with indexes.
* There may be a better order for doing things.
* Problems with destroying a deleted database--cannot create
* a struct reldesc without having an open file descriptor.
* ----------------------------------------------------------------
*/
/* --------------------------------
* RelationRemoveInheritance
*
...
...
@@ -1334,10 +1303,35 @@ DeleteTypeTuple(Relation rel)
heap_close
(
pg_type_desc
,
RowExclusiveLock
);
}
/* --------------------------------
* heap_drop_with_catalog
/* --------------------------------
--------------------------------
* heap_drop_with_catalog
- removes all record of named relation from catalogs
*
* --------------------------------
* 1) open relation, check for existence, etc.
* 2) remove inheritance information
* 3) remove indexes
* 4) remove pg_class tuple
* 5) remove pg_attribute tuples and related descriptions
* 6) remove pg_description tuples
* 7) remove pg_type tuples
* 8) RemoveConstraints ()
* 9) unlink relation
*
* old comments
* Except for vital relations, removes relation from
* relation catalog, and related attributes from
* attribute catalog (needed?). (Anything else?)
*
* get proper relation from relation catalog (if not arg)
* scan attribute catalog deleting attributes of reldesc
* (necessary?)
* delete relation from relation catalog
* (How are the tuples of the relation discarded?)
*
* XXX Must fix to work with indexes.
* There may be a better order for doing things.
* Problems with destroying a deleted database--cannot create
* a struct reldesc without having an open file descriptor.
* ----------------------------------------------------------------
*/
void
heap_drop_with_catalog
(
const
char
*
relname
,
...
...
@@ -1360,8 +1354,10 @@ heap_drop_with_catalog(const char *relname,
* prevent deletion of system relations
*/
/* allow temp of pg_class? Guess so. */
if
(
!
istemp
&&
!
allow_system_table_mods
&&
IsSystemRelationName
(
RelationGetRelationName
(
rel
)))
if
(
!
istemp
&&
!
allow_system_table_mods
&&
IsSystemRelationName
(
RelationGetRelationName
(
rel
))
&&
!
is_temp_relname
(
RelationGetRelationName
(
rel
)))
elog
(
ERROR
,
"System relation
\"
%s
\"
may not be dropped"
,
RelationGetRelationName
(
rel
));
...
...
src/backend/storage/file/fd.c
View file @
49ce6fff
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.8
1 2001/06/11 04:12:29 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.8
2 2001/06/18 16:13:21 momjian
Exp $
*
* NOTES:
*
...
...
@@ -54,8 +54,8 @@
/* Filename components for OpenTemporaryFile */
#define PG_TEMP_FILES_DIR "pg
_tempfiles
"
#define PG_TEMP_FILE_PREFIX "pg
_te
mp"
#define PG_TEMP_FILES_DIR "pg
sql_tmp
"
#define PG_TEMP_FILE_PREFIX "pg
sql_t
mp"
/*
...
...
src/backend/tcop/utility.c
View file @
49ce6fff
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.11
3 2001/06/09 23:21:54 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.11
4 2001/06/18 16:13:21 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,6 +46,7 @@
#include "utils/acl.h"
#include "utils/ps_status.h"
#include "utils/syscache.h"
#include "utils/temprel.h"
#include "access/xlog.h"
/*
...
...
@@ -120,7 +121,8 @@ CheckDropPermissions(char *name, char rightkind)
elog
(
ERROR
,
"you do not own %s
\"
%s
\"
"
,
rentry
->
name
,
name
);
if
(
!
allowSystemTableMods
&&
IsSystemRelationName
(
name
))
if
(
!
allowSystemTableMods
&&
IsSystemRelationName
(
name
)
&&
!
is_temp_relname
(
name
))
elog
(
ERROR
,
"%s
\"
%s
\"
is a system %s"
,
rentry
->
name
,
name
,
rentry
->
name
);
...
...
src/include/utils/temprel.h
View file @
49ce6fff
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: temprel.h,v 1.1
5 2001/03/22 04:01:14
momjian Exp $
* $Id: temprel.h,v 1.1
6 2001/06/18 16:13:21
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -16,6 +16,11 @@
#include "access/htup.h"
#define PG_TEMP_REL_PREFIX "pg_temp"
#define is_temp_relname(relname) \
(strncmp(relname, PG_TEMP_REL_PREFIX, strlen(PG_TEMP_REL_PREFIX)) == 0)
extern
void
create_temp_relation
(
const
char
*
relname
,
HeapTuple
pg_class_tuple
);
extern
void
remove_temp_rel_by_relid
(
Oid
relid
);
...
...
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