* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.55 1999/02/13 23:14:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.56 1999/03/17 22:52:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
static char *values[MAXATTR]; /* cooresponding attribute values */
int numattr; /* number of attributes for cur. rel */
-extern int fsyncOff; /* do not fsync the database */
+extern bool disableFsync; /* do not fsync the database */
/* The test for HAVE_SIGSETJMP fails on Linux 2.0.x because the test
* explicitly disallows sigsetjmp being a #define, which is how it
Noversion = true;
break;
case 'F':
- fsyncOff = true;
+ disableFsync = true;
break;
case 'O':
override = true;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.19 1999/02/13 23:14:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.20 1999/03/17 22:52:47 momjian Exp $
*
* NOTES
* See acl.h.
#include "utils/memutils.h"
#include "utils/syscache.h"
#include "utils/tqual.h"
+#include "miscadmin.h"
static int32 aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode);
* themselves from themselves.)
*/
if (((mode & ACL_WR) || (mode & ACL_AP)) &&
- IsSystemRelationName(relname) &&
+ !allowSystemTableMods && IsSystemRelationName(relname) &&
!((Form_pg_shadow) GETSTRUCT(tuple))->usecatupd)
{
elog(DEBUG, "pg_aclcheck: catalog update to \"%s\": permission denied",
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.75 1999/02/23 07:54:03 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.76 1999/03/17 22:52:48 momjian Exp $
*
*
* INTERFACE ROUTINES
*/
AssertArg(natts > 0);
- if (relname && IsSystemRelationName(relname) && IsNormalProcessingMode())
+ if (relname && !allowSystemTableMods && IsSystemRelationName(relname) && IsNormalProcessingMode())
{
elog(ERROR, "Illegal class name '%s'"
"\n\tThe 'pg_' name prefix is reserved for system catalogs",
* ----------------
*/
/* allow temp of pg_class? Guess so. */
- if (!istemp && IsSystemRelationName(RelationGetRelationName(rel)->data))
+ if (!istemp &&
+ !allowSystemTableMods && IsSystemRelationName(RelationGetRelationName(rel)->data))
elog(ERROR, "System relation '%s' cannot be destroyed",
&rel->rd_rel->relname);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.39 1999/02/24 17:28:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.40 1999/03/17 22:52:51 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
*
* normally, only the owner of a class can change its schema.
*/
- if (IsSystemRelationName(relationName))
+ if (!allowSystemTableMods && IsSystemRelationName(relationName))
elog(ERROR, "PerformAddAttribute: class \"%s\" is a system catalog",
relationName);
#ifndef NO_SECURITY
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.21 1999/02/13 23:15:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.22 1999/03/17 22:52:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*
* normally, only the owner of a class can change its schema.
*/
- if (IsSystemRelationName(relname))
+ if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "renameatt: class \"%s\" is a system catalog",
relname);
#ifndef NO_SECURITY
newpath[MAXPGPATH];
Relation irelations[Num_pg_class_indices];
- if (IsSystemRelationName(oldrelname))
+ if (!allowSystemTableMods && IsSystemRelationName(oldrelname))
elog(ERROR, "renamerel: system relation \"%s\" not renamed",
oldrelname);
- if (IsSystemRelationName(newrelname))
+ if (!allowSystemTableMods && IsSystemRelationName(newrelname))
elog(ERROR, "renamerel: Illegal class name: \"%s\" -- pg_ is reserved for system catalogs",
newrelname);
int found = 0;
int i;
- if (IsSystemRelationName(stmt->relname))
+ if (!allowSystemTableMods && IsSystemRelationName(stmt->relname))
elog(ERROR, "CreateTrigger: can't create trigger for system relation %s", stmt->relname);
#ifndef NO_SECURITY
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.81 1999/03/17 21:02:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.82 1999/03/17 22:52:57 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Id: fd.c,v 1.37 1999/02/13 23:18:05 momjian Exp $
+ * $Id: fd.c,v 1.38 1999/03/17 22:53:06 momjian Exp $
*
* NOTES:
*
int
pg_fsync(int fd)
{
- extern int fsyncOff;
-
- return fsyncOff ? 0 : fsync(fd);
+ return disableFsync ? 0 : fsync(fd);
}
#define fsync pg_fsync
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.104 1999/02/21 03:49:27 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.105 1999/03/17 22:53:18 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
#ifdef LOCK_MGR_DEBUG
fprintf(stderr, "\t-K \t\tset locking debug level [0|1|2]\n");
#endif
+ fprintf(stderr, "\t-O \t\tallow system table structure changes\n");
fprintf(stderr, "\t-P port\t\tset port file descriptor\n");
fprintf(stderr, "\t-Q \t\tsuppress informational messages\n");
fprintf(stderr, "\t-S buffers\tset amount of sort memory available\n");
optind = 1; /* reset after postmaster usage */
while ((flag = getopt(argc, argv,
- "A:B:CD:d:Eef:iK:Lm:MNo:P:pQS:st:v:x:FW:"))
+ "A:B:CD:d:Eef:iK:Lm:MNOo:P:pQS:st:v:x:FW:"))
!= EOF)
switch (flag)
{
* turn off fsync
* --------------------
*/
- fsyncOff = 1;
+ disableFsync = true;
break;
case 'f':
StrNCpy(OutputFileName, optarg, MAXPGPATH);
break;
+ case 'O':
+ /* --------------------
+ * allow system table structure modifications
+ * --------------------
+ */
+ allowSystemTableMods = true;
+ break;
+
case 'p': /* started by postmaster */
/* ----------------
* p - special flag passed if backend was forked
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.104 $ $Date: 1999/02/21 03:49:27 $\n");
+ puts("$Revision: 1.105 $ $Date: 1999/03/17 22:53:18 $\n");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.58 1999/03/16 03:24:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.59 1999/03/17 22:53:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
foreach(arg, args)
{
relname = strVal(lfirst(arg));
- if (IsSystemRelationName(relname))
+ if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "class \"%s\" is a system catalog",
relname);
rel = heap_openr(relname);
CHECK_IF_ABORTED();
relname = stmt->relname;
- if (IsSystemRelationName(relname))
+ if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "class \"%s\" is a system catalog",
relname);
#ifndef NO_SECURITY
{
case INDEX:
relname = stmt->name;
- if (IsSystemRelationName(relname))
+ if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "class \"%s\" is a system catalog index",
relname);
#ifndef NO_SECURITY
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.27 1999/02/13 23:20:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.28 1999/03/17 22:53:19 momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
* malloc? XXX */
char FloatFormat[20] = "%f";
-int fsyncOff = 0;
+bool disableFsync = false;
+bool allowSystemTableMods = false;
int SortMem = 512;
char *IndexedCatalogNames[] = {
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.57 1999/01/28 15:28:40 wieck Exp $
+# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.58 1999/03/17 22:53:25 momjian Exp $
#
#-------------------------------------------------------------------------
echo
-PGSQL_OPT="-o /dev/null -F -Q -D$PGDATA"
+PGSQL_OPT="-o /dev/null -O -F -Q -D$PGDATA"
# If the COPY is first, the VACUUM generates an error, so we vacuum first
echo "Vacuuming template1"
postgres $PGSQL_OPT template1 > /dev/null
echo "Creating public pg_user view"
-echo "CREATE TABLE xpg_user ( \
+echo "CREATE TABLE pg_user ( \
usename name, \
usesysid int4, \
usecreatedb bool, \
passwd text, \
valuntil abstime);" | postgres $PGSQL_OPT template1 > /dev/null
-#move it into pg_user
-echo "UPDATE pg_class SET relname = 'pg_user' WHERE relname = 'xpg_user';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-echo "UPDATE pg_type SET typname = 'pg_user' WHERE typname = 'xpg_user';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-mv $PGDATA/base/template1/xpg_user $PGDATA/base/template1/pg_user
echo "CREATE RULE \"_RETpg_user\" AS ON SELECT TO pg_user DO INSTEAD \
SELECT usename, usesysid, usecreatedb, usetrace, \
postgres $PGSQL_OPT template1 > /dev/null
echo "Creating view pg_rules"
-echo "CREATE TABLE xpg_rules ( \
+echo "CREATE TABLE pg_rules ( \
tablename name, \
rulename name, \
definition text);" | postgres $PGSQL_OPT template1 > /dev/null
-#move it into pg_rules
-echo "UPDATE pg_class SET relname = 'pg_rules' WHERE relname = 'xpg_rules';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-echo "UPDATE pg_type SET typname = 'pg_rules' WHERE typname = 'xpg_rules';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-mv $PGDATA/base/template1/xpg_rules $PGDATA/base/template1/pg_rules
echo "CREATE RULE \"_RETpg_rules\" AS ON SELECT TO pg_rules DO INSTEAD \
SELECT C.relname AS tablename, \
postgres $PGSQL_OPT template1 > /dev/null
echo "Creating view pg_views"
-echo "CREATE TABLE xpg_views ( \
+echo "CREATE TABLE pg_views ( \
viewname name, \
viewowner name, \
definition text);" | postgres $PGSQL_OPT template1 > /dev/null
-#move it into pg_views
-echo "UPDATE pg_class SET relname = 'pg_views' WHERE relname = 'xpg_views';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-echo "UPDATE pg_type SET typname = 'pg_views' WHERE typname = 'xpg_views';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-mv $PGDATA/base/template1/xpg_views $PGDATA/base/template1/pg_views
echo "CREATE RULE \"_RETpg_views\" AS ON SELECT TO pg_views DO INSTEAD \
SELECT C.relname AS viewname, \
postgres $PGSQL_OPT template1 > /dev/null
echo "Creating view pg_tables"
-echo "CREATE TABLE xpg_tables ( \
+echo "CREATE TABLE pg_tables ( \
tablename name, \
tableowner name, \
hasindexes bool, \
hasrules bool, \
hastriggers bool);" | postgres $PGSQL_OPT template1 > /dev/null
-#move it into pg_tables
-echo "UPDATE pg_class SET relname = 'pg_tables' WHERE relname = 'xpg_tables';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-echo "UPDATE pg_type SET typname = 'pg_tables' WHERE typname = 'xpg_tables';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-mv $PGDATA/base/template1/xpg_tables $PGDATA/base/template1/pg_tables
echo "CREATE RULE \"_RETpg_tables\" AS ON SELECT TO pg_tables DO INSTEAD \
SELECT C.relname AS tablename, \
postgres $PGSQL_OPT template1 > /dev/null
echo "Creating view pg_indexes"
-echo "CREATE TABLE xpg_indexes ( \
+echo "CREATE TABLE pg_indexes ( \
tablename name, \
indexname name, \
indexdef text);" | postgres $PGSQL_OPT template1 > /dev/null
-#move it into pg_indexes
-echo "UPDATE pg_class SET relname = 'pg_indexes' WHERE relname = 'xpg_indexes';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-echo "UPDATE pg_type SET typname = 'pg_indexes' WHERE typname = 'xpg_indexes';" |\
- postgres $PGSQL_OPT template1 > /dev/null
-mv $PGDATA/base/template1/xpg_indexes $PGDATA/base/template1/pg_indexes
echo "CREATE RULE \"_RETpg_indexes\" AS ON SELECT TO pg_indexes DO INSTEAD \
SELECT C.relname AS tablename, \
postgres $PGSQL_OPT template1 > /dev/null
echo "vacuum analyze" | \
postgres $PGSQL_OPT template1 > /dev/null
-
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.35 1999/02/13 23:20:46 momjian Exp $
+ * $Id: miscadmin.h,v 1.36 1999/03/17 22:53:30 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
extern char FloatFormat[];
extern char DateFormat[];
-extern int fsyncOff;
+extern bool disableFsync;
+extern bool allowSystemTableMods;
extern int SortMem;
extern Oid LastOidProcessed; /* for query rewrite */
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/src/man/Attic/postgres.1,v 1.13 1999/02/18 05:26:34 momjian Exp $
+.\" $Header: /cvsroot/pgsql/src/man/Attic/postgres.1,v 1.14 1999/03/17 22:53:31 momjian Exp $
.TH POSTGRESQL UNIX 12/08/96 PostgreSQL PostgreSQL
.SH NAME
postgres - the Postgres backend server
.BR "-F"
]
[\c
+.BR "-O"
+]
+[\c
.BR "-P"
filedes]
[\c
This option improves performance, but an operating system crash
while a transaction is in progress will probably cause data loss.
.TP
+.BR "-O"
+Override restrictions, so system table structures can be modified(pg_*).
+.TP
.BR "-P" " filedes"
.IR "filedes"
specifies the file descriptor that corresponds to the socket (port) on