mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
OK, folks, here is the pgindent output.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.14 1998/08/19 02:01:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.15 1998/09/01 04:28:09 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* At the point the version is defined, 2 physical relations are created
|
||||
@@ -303,7 +303,7 @@ VersionDelete(char *vname, char *bname, char *snapshot)
|
||||
vname, vname, vname, bname, bname, snapshot, bname);
|
||||
|
||||
eval_as_new_xact(rule_buf);
|
||||
#endif /* OLD_REWRITE */
|
||||
#endif /* OLD_REWRITE */
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -355,7 +355,7 @@ VersionReplace(char *vname, char *bname, char *snapshot)
|
||||
vname, vname, vname, attr_list, bname, bname, snapshot, vname, bname);
|
||||
|
||||
eval_as_new_xact(rule_buf);
|
||||
#endif /* OLD_REWRITE */
|
||||
#endif /* OLD_REWRITE */
|
||||
/* printf("%s\n",rule_buf); */
|
||||
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.39 1998/09/01 03:21:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.40 1998/09/01 04:27:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -64,10 +64,10 @@
|
||||
#include <utils/ps_status.h>
|
||||
|
||||
#define NotifyUnlock pg_options[OPT_NOTIFYUNLOCK]
|
||||
#define NotifyHack pg_options[OPT_NOTIFYHACK]
|
||||
#define NotifyHack pg_options[OPT_NOTIFYHACK]
|
||||
|
||||
extern TransactionState CurrentTransactionState;
|
||||
extern CommandDest whereToSendOutput;
|
||||
extern CommandDest whereToSendOutput;
|
||||
|
||||
GlobalMemory notifyContext = NULL;
|
||||
|
||||
@@ -119,7 +119,7 @@ Async_NotifyHandler(SIGNAL_ARGS)
|
||||
else
|
||||
{
|
||||
TPRINTF(TRACE_NOTIFY, "Async_NotifyHandler: "
|
||||
"process in middle of transaction, state=%d, blockstate=%d",
|
||||
"process in middle of transaction, state=%d, blockstate=%d",
|
||||
CurrentTransactionState->state,
|
||||
CurrentTransactionState->blockState);
|
||||
notifyFrontEndPending = 1;
|
||||
@@ -213,13 +213,12 @@ Async_Notify(char *relname)
|
||||
heap_endscan(sRel);
|
||||
|
||||
/*
|
||||
* Note: if the write lock is unset we can get multiple tuples
|
||||
* with same oid if other backends notify the same relation.
|
||||
* Use this option at your own risk.
|
||||
* Note: if the write lock is unset we can get multiple tuples with
|
||||
* same oid if other backends notify the same relation. Use this
|
||||
* option at your own risk.
|
||||
*/
|
||||
if (NotifyUnlock) {
|
||||
if (NotifyUnlock)
|
||||
RelationUnsetLockForWrite(lRel);
|
||||
}
|
||||
|
||||
heap_close(lRel);
|
||||
|
||||
@@ -318,12 +317,13 @@ Async_NotifyAtCommit()
|
||||
heap_close(lRel);
|
||||
|
||||
/*
|
||||
* Notify the frontend inside the current transaction while
|
||||
* we still have a valid write lock on pg_listeners. This
|
||||
* avoid waiting until all other backends have finished
|
||||
* with pg_listener.
|
||||
* Notify the frontend inside the current transaction while we
|
||||
* still have a valid write lock on pg_listeners. This avoid
|
||||
* waiting until all other backends have finished with
|
||||
* pg_listener.
|
||||
*/
|
||||
if (notifyFrontEndPending) {
|
||||
if (notifyFrontEndPending)
|
||||
{
|
||||
/* The aux version is called inside transaction */
|
||||
Async_NotifyFrontEnd_Aux();
|
||||
}
|
||||
@@ -333,14 +333,14 @@ Async_NotifyAtCommit()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* No notifies issued by us. If notifyFrontEndPending has been set
|
||||
* by Async_NotifyHandler notify the frontend of pending notifies
|
||||
* from other backends.
|
||||
* No notifies issued by us. If notifyFrontEndPending has been
|
||||
* set by Async_NotifyHandler notify the frontend of pending
|
||||
* notifies from other backends.
|
||||
*/
|
||||
if (notifyFrontEndPending) {
|
||||
if (notifyFrontEndPending)
|
||||
Async_NotifyFrontEnd();
|
||||
}
|
||||
}
|
||||
|
||||
ClearPendingNotify();
|
||||
@@ -368,7 +368,8 @@ Async_NotifyAtCommit()
|
||||
void
|
||||
Async_NotifyAtAbort()
|
||||
{
|
||||
if (pendingNotifies) {
|
||||
if (pendingNotifies)
|
||||
{
|
||||
ClearPendingNotify();
|
||||
DLFreeList(pendingNotifies);
|
||||
}
|
||||
@@ -380,9 +381,7 @@ Async_NotifyAtAbort()
|
||||
{
|
||||
/* don't forget to notify front end */
|
||||
if (notifyFrontEndPending)
|
||||
{
|
||||
Async_NotifyFrontEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +422,8 @@ Async_Listen(char *relname, int pid)
|
||||
char *relnamei;
|
||||
TupleDesc tupDesc;
|
||||
|
||||
if (whereToSendOutput != Remote) {
|
||||
if (whereToSendOutput != Remote)
|
||||
{
|
||||
elog(NOTICE, "Async_Listen: "
|
||||
"listen not available on interactive sessions");
|
||||
return;
|
||||
@@ -459,7 +459,8 @@ Async_Listen(char *relname, int pid)
|
||||
if (pid == MyProcPid)
|
||||
alreadyListener = 1;
|
||||
}
|
||||
if (alreadyListener) {
|
||||
if (alreadyListener)
|
||||
{
|
||||
/* No need to scan the rest of the table */
|
||||
break;
|
||||
}
|
||||
@@ -521,7 +522,8 @@ Async_Unlisten(char *relname, int pid)
|
||||
HeapTuple lTuple;
|
||||
|
||||
/* Handle specially the `unlisten "*"' command */
|
||||
if ((!relname) || (*relname == '\0') || (strcmp(relname,"*")==0)) {
|
||||
if ((!relname) || (*relname == '\0') || (strcmp(relname, "*") == 0))
|
||||
{
|
||||
Async_UnlistenAll();
|
||||
return;
|
||||
}
|
||||
@@ -575,15 +577,13 @@ Async_UnlistenAll()
|
||||
sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
|
||||
|
||||
while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
|
||||
{
|
||||
heap_delete(lRel, &lTuple->t_ctid);
|
||||
}
|
||||
heap_endscan(sRel);
|
||||
RelationUnsetLockForWrite(lRel);
|
||||
heap_close(lRel);
|
||||
TPRINTF(TRACE_NOTIFY, "Async_UnlistenAll: done");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------
|
||||
* Async_UnlistenOnExit --
|
||||
@@ -654,7 +654,7 @@ Async_NotifyFrontEnd_Aux()
|
||||
|
||||
#define MAX_DONE 64
|
||||
|
||||
char *done[MAX_DONE];
|
||||
char *done[MAX_DONE];
|
||||
int ndone = 0;
|
||||
int i;
|
||||
|
||||
@@ -687,13 +687,16 @@ Async_NotifyFrontEnd_Aux()
|
||||
&isnull);
|
||||
|
||||
/*
|
||||
* This hack deletes duplicate tuples which can be left
|
||||
* in the table if the NotifyUnlock option is set.
|
||||
* I'm further investigating this. -- dz
|
||||
* This hack deletes duplicate tuples which can be left in the
|
||||
* table if the NotifyUnlock option is set. I'm further
|
||||
* investigating this. -- dz
|
||||
*/
|
||||
if (NotifyHack) {
|
||||
for (i=0; i<ndone; i++) {
|
||||
if (strcmp(DatumGetName(d)->data, done[i]) == 0) {
|
||||
if (NotifyHack)
|
||||
{
|
||||
for (i = 0; i < ndone; i++)
|
||||
{
|
||||
if (strcmp(DatumGetName(d)->data, done[i]) == 0)
|
||||
{
|
||||
TPRINTF(TRACE_NOTIFY,
|
||||
"Async_NotifyFrontEnd: duplicate %s",
|
||||
DatumGetName(d)->data);
|
||||
@@ -701,9 +704,8 @@ Async_NotifyFrontEnd_Aux()
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ndone < MAX_DONE) {
|
||||
if (ndone < MAX_DONE)
|
||||
done[ndone++] = pstrdup(DatumGetName(d)->data);
|
||||
}
|
||||
}
|
||||
|
||||
rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl);
|
||||
|
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.30 1998/09/01 03:21:52 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.31 1998/09/01 04:27:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -47,7 +47,7 @@
|
||||
#include <optimizer/internal.h>
|
||||
#ifndef NO_SECURITY
|
||||
#include <utils/acl.h>
|
||||
#endif /* !NO_SECURITY */
|
||||
#endif /* !NO_SECURITY */
|
||||
|
||||
static Relation copy_heap(Oid OIDOldHeap);
|
||||
static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap);
|
||||
@@ -128,7 +128,8 @@ cluster(char *oldrelname, char *oldindexname)
|
||||
elog(ERROR, "cluster: unknown relation: \"%s\"",
|
||||
oldrelname);
|
||||
}
|
||||
OIDOldHeap = RelationGetRelid(OldHeap);/* Get OID for the index scan */
|
||||
OIDOldHeap = RelationGetRelid(OldHeap); /* Get OID for the index
|
||||
* scan */
|
||||
|
||||
OldIndex = index_openr(oldindexname); /* Open old index relation */
|
||||
if (!RelationIsValid(OldIndex))
|
||||
@@ -136,7 +137,7 @@ cluster(char *oldrelname, char *oldindexname)
|
||||
elog(ERROR, "cluster: unknown index: \"%s\"",
|
||||
oldindexname);
|
||||
}
|
||||
OIDOldIndex = RelationGetRelid(OldIndex); /* OID for the index scan */
|
||||
OIDOldIndex = RelationGetRelid(OldIndex); /* OID for the index scan */
|
||||
|
||||
heap_close(OldHeap);
|
||||
index_close(OldIndex);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.31 1998/09/01 03:21:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.32 1998/09/01 04:27:46 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The PortalExecutorHeapMemory crap needs to be eliminated
|
||||
@@ -422,16 +422,16 @@ PerformAddAttribute(char *relationName,
|
||||
int attnelems;
|
||||
|
||||
tup = SearchSysCacheTuple(ATTNAME,
|
||||
ObjectIdGetDatum(reltup->t_oid),
|
||||
PointerGetDatum(colDef->colname),
|
||||
0, 0);
|
||||
ObjectIdGetDatum(reltup->t_oid),
|
||||
PointerGetDatum(colDef->colname),
|
||||
0, 0);
|
||||
|
||||
if (HeapTupleIsValid(tup))
|
||||
{
|
||||
heap_close(attrdesc);
|
||||
heap_close(rel);
|
||||
elog(ERROR, "PerformAddAttribute: attribute \"%s\" already exists in class \"%s\"",
|
||||
colDef->colname, relationName);
|
||||
colDef->colname, relationName);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.58 1998/09/01 03:21:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.59 1998/09/01 04:27:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -52,8 +52,7 @@ static Oid GetOutputFunction(Oid type);
|
||||
static Oid GetTypeElement(Oid type);
|
||||
static Oid GetInputFunction(Oid type);
|
||||
static Oid IsTypeByVal(Oid type);
|
||||
static void
|
||||
GetIndexRelations(Oid main_relation_oid,
|
||||
static void GetIndexRelations(Oid main_relation_oid,
|
||||
int *n_indices,
|
||||
Relation **index_rels);
|
||||
|
||||
@@ -108,17 +107,17 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
|
||||
the class.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static FILE *fp; /* static for cleanup */
|
||||
static bool file_opened = false; /* static for cleanup */
|
||||
static FILE *fp; /* static for cleanup */
|
||||
static bool file_opened = false; /* static for cleanup */
|
||||
Relation rel;
|
||||
extern char *UserName; /* defined in global.c */
|
||||
const AclMode required_access = from ? ACL_WR : ACL_RD;
|
||||
int result;
|
||||
|
||||
/*
|
||||
* Close previous file opened for COPY but failed with elog().
|
||||
* There should be a better way, but would not be modular.
|
||||
* Prevents file descriptor leak. bjm 1998/08/29
|
||||
* Close previous file opened for COPY but failed with elog(). There
|
||||
* should be a better way, but would not be modular. Prevents file
|
||||
* descriptor leak. bjm 1998/08/29
|
||||
*/
|
||||
if (file_opened)
|
||||
FreeFile(fp);
|
||||
@@ -449,7 +448,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
itupdescArr[i] = RelationGetDescr(index_rels[i]);
|
||||
pgIndexTup =
|
||||
SearchSysCacheTuple(INDEXRELID,
|
||||
ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
|
||||
ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
|
||||
0, 0, 0);
|
||||
Assert(pgIndexTup);
|
||||
pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup);
|
||||
@@ -500,7 +499,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
/* SetSlotShouldFree(slot, false); */
|
||||
slot->ttc_buffer = (Buffer) NULL;
|
||||
slot->ttc_shouldFree = false;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -766,7 +765,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
/* SetSlotContents(slot, tuple); */
|
||||
if (ExecQual((List *) indexPred[i], econtext) == false)
|
||||
continue;
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
#endif /* OMIT_PARTIAL_INDEX */
|
||||
}
|
||||
FormIndexDatum(indexNatts[i],
|
||||
(AttrNumber *) &(pgIndexP[i]->indkey[0]),
|
||||
@@ -1022,11 +1021,13 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
|
||||
char c;
|
||||
int done = 0;
|
||||
int i = 0;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
int mblen;
|
||||
int encoding;
|
||||
unsigned char s[2];
|
||||
int j;
|
||||
int mblen;
|
||||
int encoding;
|
||||
unsigned char s[2];
|
||||
int j;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
@@ -1136,22 +1137,23 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
|
||||
if (!done)
|
||||
attribute[i++] = c;
|
||||
#ifdef MULTIBYTE
|
||||
s[0] = c;
|
||||
mblen = pg_encoding_mblen(encoding, s);
|
||||
mblen--;
|
||||
for(j=0;j<mblen;j++) {
|
||||
c = getc(fp);
|
||||
if (feof(fp))
|
||||
return NULL;
|
||||
attribute[i++] = c;
|
||||
}
|
||||
s[0] = c;
|
||||
mblen = pg_encoding_mblen(encoding, s);
|
||||
mblen--;
|
||||
for (j = 0; j < mblen; j++)
|
||||
{
|
||||
c = getc(fp);
|
||||
if (feof(fp))
|
||||
return NULL;
|
||||
attribute[i++] = c;
|
||||
}
|
||||
#endif
|
||||
if (i == EXT_ATTLEN - 1)
|
||||
elog(ERROR, "CopyReadAttribute - attribute length too long. line: %d", lineno);
|
||||
}
|
||||
attribute[i] = '\0';
|
||||
#ifdef MULTIBYTE
|
||||
return(pg_client_to_server((unsigned char*)attribute, strlen(attribute)));
|
||||
return (pg_client_to_server((unsigned char *) attribute, strlen(attribute)));
|
||||
#else
|
||||
return &attribute[0];
|
||||
#endif
|
||||
@@ -1160,13 +1162,14 @@ CopyReadAttribute(FILE *fp, bool *isnull, char *delim)
|
||||
static void
|
||||
CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array)
|
||||
{
|
||||
char *string;
|
||||
char *string;
|
||||
char c;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
int mblen;
|
||||
int encoding;
|
||||
int i;
|
||||
int mblen;
|
||||
int encoding;
|
||||
int i;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
@@ -1178,7 +1181,7 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array)
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
for (; (mblen = pg_encoding_mblen(encoding, string)) &&
|
||||
((c = *string) != '\0'); string += mblen)
|
||||
((c = *string) != '\0'); string += mblen)
|
||||
#else
|
||||
for (; (c = *string) != '\0'; string++)
|
||||
#endif
|
||||
@@ -1204,9 +1207,8 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim, int is_array)
|
||||
}
|
||||
}
|
||||
#ifdef MULTIBYTE
|
||||
for (i=0;i<mblen;i++) {
|
||||
fputc(*(string+i), fp);
|
||||
}
|
||||
for (i = 0; i < mblen; i++)
|
||||
fputc(*(string + i), fp);
|
||||
#else
|
||||
fputc(*string, fp);
|
||||
#endif
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.33 1998/09/01 03:21:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.34 1998/09/01 04:27:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -33,8 +33,7 @@
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
static int
|
||||
checkAttrExists(char *attributeName,
|
||||
static int checkAttrExists(char *attributeName,
|
||||
char *attributeType, List *schema);
|
||||
static List *MergeAttributes(List *schema, List *supers, List **supconstr);
|
||||
static void StoreCatalogInheritance(Oid relationId, List *supers);
|
||||
@@ -404,7 +403,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
|
||||
char nullarr[Natts_pg_inherits];
|
||||
|
||||
tuple = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(strVal(lfirst(entry))),
|
||||
PointerGetDatum(strVal(lfirst(entry))),
|
||||
0, 0, 0);
|
||||
AssertArg(HeapTupleIsValid(tuple));
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.23 1998/09/01 03:21:57 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.24 1998/09/01 04:27:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,7 @@
|
||||
|
||||
|
||||
/* non-export function prototypes */
|
||||
static void
|
||||
check_permissions(char *command, char *dbpath, char *dbname,
|
||||
static void check_permissions(char *command, char *dbpath, char *dbname,
|
||||
Oid *dbIdP, int4 *userIdP);
|
||||
static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
|
||||
static void stop_vacuum(char *dbpath, char *dbname);
|
||||
@@ -46,7 +45,7 @@ void
|
||||
createdb(char *dbname, char *dbpath, int encoding)
|
||||
{
|
||||
Oid db_id;
|
||||
int4 user_id;
|
||||
int4 user_id;
|
||||
char buf[512];
|
||||
char *lp,
|
||||
loc[512];
|
||||
@@ -100,7 +99,7 @@ createdb(char *dbname, char *dbpath, int encoding)
|
||||
void
|
||||
destroydb(char *dbname)
|
||||
{
|
||||
int4 user_id;
|
||||
int4 user_id;
|
||||
Oid db_id;
|
||||
char *path;
|
||||
char dbpath[MAXPGPATH + 1];
|
||||
@@ -203,8 +202,8 @@ check_permissions(char *command,
|
||||
|
||||
userName = GetPgUserName();
|
||||
utup = SearchSysCacheTuple(USENAME,
|
||||
PointerGetDatum(userName),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(userName),
|
||||
0, 0, 0);
|
||||
*userIdP = ((Form_pg_shadow) GETSTRUCT(utup))->usesysid;
|
||||
use_super = ((Form_pg_shadow) GETSTRUCT(utup))->usesuper;
|
||||
use_createdb = ((Form_pg_shadow) GETSTRUCT(utup))->usecreatedb;
|
||||
@@ -249,9 +248,9 @@ check_permissions(char *command,
|
||||
if (dbfound)
|
||||
{
|
||||
dbowner = (int4) heap_getattr(dbtup,
|
||||
Anum_pg_database_datdba,
|
||||
RelationGetDescr(dbrel),
|
||||
(char *) NULL);
|
||||
Anum_pg_database_datdba,
|
||||
RelationGetDescr(dbrel),
|
||||
(char *) NULL);
|
||||
*dbIdP = dbtup->t_oid;
|
||||
dbtext = (text *) heap_getattr(dbtup,
|
||||
Anum_pg_database_datpath,
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.25 1998/09/01 03:21:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.26 1998/09/01 04:27:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,16 +41,13 @@
|
||||
|
||||
/* non-export function prototypes */
|
||||
static void CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid);
|
||||
static void
|
||||
CheckPredExpr(Node *predicate, List *rangeTable,
|
||||
static void CheckPredExpr(Node *predicate, List *rangeTable,
|
||||
Oid baseRelOid);
|
||||
static void
|
||||
CheckPredClause(Expr *predicate, List *rangeTable, Oid baseRelOid);
|
||||
static void
|
||||
FuncIndexArgs(IndexElem *funcIndex, AttrNumber *attNumP,
|
||||
static void FuncIndexArgs(IndexElem *funcIndex, AttrNumber *attNumP,
|
||||
Oid *argTypes, Oid *opOidP, Oid relId);
|
||||
static void
|
||||
NormIndexAttrs(List *attList, AttrNumber *attNumP,
|
||||
static void NormIndexAttrs(List *attList, AttrNumber *attNumP,
|
||||
Oid *opOidP, Oid relId);
|
||||
static char *GetDefaultOpClass(Oid atttypid);
|
||||
|
||||
@@ -197,7 +194,7 @@ DefineIndex(char *heapRelationName,
|
||||
else
|
||||
{
|
||||
attributeNumberA = (AttrNumber *) palloc(numberOfAttributes *
|
||||
sizeof attributeNumberA[0]);
|
||||
sizeof attributeNumberA[0]);
|
||||
|
||||
classObjectId =
|
||||
(Oid *) palloc(numberOfAttributes * sizeof classObjectId[0]);
|
||||
@@ -468,7 +465,8 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
|
||||
Oid relId)
|
||||
{
|
||||
List *rest;
|
||||
HeapTuple atttuple, tuple;
|
||||
HeapTuple atttuple,
|
||||
tuple;
|
||||
|
||||
/*
|
||||
* process attributeList
|
||||
@@ -485,9 +483,9 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
|
||||
elog(ERROR, "missing attribute for define index");
|
||||
|
||||
atttuple = SearchSysCacheTupleCopy(ATTNAME,
|
||||
ObjectIdGetDatum(relId),
|
||||
PointerGetDatum(attribute->name),
|
||||
0, 0);
|
||||
ObjectIdGetDatum(relId),
|
||||
PointerGetDatum(attribute->name),
|
||||
0, 0);
|
||||
if (!HeapTupleIsValid(atttuple))
|
||||
{
|
||||
elog(ERROR,
|
||||
@@ -502,8 +500,8 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
|
||||
if (attribute->typename == NULL)
|
||||
{
|
||||
tuple = SearchSysCacheTuple(TYPOID,
|
||||
ObjectIdGetDatum(attform->atttypid),
|
||||
0, 0, 0);
|
||||
ObjectIdGetDatum(attform->atttypid),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "create index: type for attribute '%s' undefined",
|
||||
attribute->name);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.23 1998/08/04 16:43:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.24 1998/09/01 04:27:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
||||
|
||||
if (es->printNodes)
|
||||
s = nodeToString(plan);
|
||||
|
||||
|
||||
if (es->printCost)
|
||||
{
|
||||
s2 = Explain_PlanToString(plan, es);
|
||||
@@ -107,7 +107,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
||||
len -= ELOG_MAXLEN - 64;
|
||||
}
|
||||
if (es->printNodes)
|
||||
pprint(plan); /* display in postmaster log file */
|
||||
pprint(plan); /* display in postmaster log file */
|
||||
|
||||
pfree(es);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
||||
static void
|
||||
explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
|
||||
{
|
||||
List *l;
|
||||
List *l;
|
||||
Relation relation;
|
||||
char *pname;
|
||||
char buf[1000];
|
||||
@@ -280,11 +280,11 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
|
||||
List *saved_rtable = es->rtable;
|
||||
List *lst;
|
||||
int whichplan = 0;
|
||||
Append *appendplan = (Append *)plan;
|
||||
Append *appendplan = (Append *) plan;
|
||||
|
||||
foreach(lst, appendplan->appendplans)
|
||||
{
|
||||
Plan *subnode = (Plan *)lfirst(lst);
|
||||
Plan *subnode = (Plan *) lfirst(lst);
|
||||
|
||||
if (appendplan->inheritrelid > 0)
|
||||
{
|
||||
|
@@ -162,8 +162,8 @@ DropProceduralLanguage(DropPLangStmt *stmt)
|
||||
case_translate_language_name(stmt->plname, languageName);
|
||||
|
||||
langTup = SearchSysCacheTupleCopy(LANNAME,
|
||||
PointerGetDatum(languageName),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(languageName),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(langTup))
|
||||
elog(ERROR, "Language %s doesn't exist", languageName);
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.23 1998/09/01 03:22:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.24 1998/09/01 04:27:56 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -64,39 +64,31 @@ typedef struct _teeInfo
|
||||
QueryTreeList *appendQlist(QueryTreeList *q1, QueryTreeList *q2);
|
||||
void OffsetVarAttno(Node *node, int varno, int offset);
|
||||
|
||||
static void
|
||||
appendTeeQuery(TeeInfo * teeInfo,
|
||||
static void appendTeeQuery(TeeInfo * teeInfo,
|
||||
QueryTreeList *q,
|
||||
char *teeNodeName);
|
||||
|
||||
static Plan *
|
||||
replaceTeeScans(Plan *plan,
|
||||
static Plan *replaceTeeScans(Plan *plan,
|
||||
Query *parsetree,
|
||||
TeeInfo * teeInfo);
|
||||
static void
|
||||
replaceSeqScan(Plan *plan,
|
||||
static void replaceSeqScan(Plan *plan,
|
||||
Plan *parent,
|
||||
int rt_ind,
|
||||
Plan *tplan);
|
||||
|
||||
static void
|
||||
tg_rewriteQuery(TgRecipe * r, TgNode * n,
|
||||
static void tg_rewriteQuery(TgRecipe * r, TgNode * n,
|
||||
QueryTreeList *q,
|
||||
QueryTreeList *inputQlist);
|
||||
static Node *
|
||||
tg_replaceNumberedParam(Node *expression,
|
||||
static Node *tg_replaceNumberedParam(Node *expression,
|
||||
int pnum,
|
||||
int rt_ind,
|
||||
char *teeRelName);
|
||||
static Node *
|
||||
tg_rewriteParamsInExpr(Node *expression,
|
||||
static Node *tg_rewriteParamsInExpr(Node *expression,
|
||||
QueryTreeList *inputQlist);
|
||||
static QueryTreeList *
|
||||
tg_parseSubQuery(TgRecipe * r,
|
||||
static QueryTreeList *tg_parseSubQuery(TgRecipe * r,
|
||||
TgNode * n,
|
||||
TeeInfo * teeInfo);
|
||||
static QueryTreeList *
|
||||
tg_parseTeeNode(TgRecipe * r,
|
||||
static QueryTreeList *tg_parseTeeNode(TgRecipe * r,
|
||||
TgNode * n,
|
||||
int i,
|
||||
QueryTreeList *qList,
|
||||
@@ -193,7 +185,7 @@ beginRecipe(RecipeStmt *stmt)
|
||||
|
||||
#ifdef DEBUG_RECIPE
|
||||
elog(NOTICE, "beginRecipe: eyes[%d] = %s\n", i, e->nodeName);
|
||||
#endif /* DEBUG_RECIPE */
|
||||
#endif /* DEBUG_RECIPE */
|
||||
|
||||
qList = tg_parseSubQuery(r, e->inNodes->val[0], teeInfo);
|
||||
|
||||
@@ -851,7 +843,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
|
||||
#ifdef DEBUG_RECIPE
|
||||
elog(NOTICE, "calling parser with %s", elem->src);
|
||||
#endif /* DEBUG_RECIPE */
|
||||
#endif /* DEBUG_RECIPE */
|
||||
|
||||
parameterCount = getParamTypes(elem, typev);
|
||||
|
||||
@@ -894,7 +886,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
|
||||
#ifdef DEBUG_RECIPE
|
||||
elog(NOTICE, "calling parser with %s", newquery);
|
||||
#endif /* DEBUG_RECIPE */
|
||||
#endif /* DEBUG_RECIPE */
|
||||
|
||||
qList = parser(newquery, typev, parameterCount);
|
||||
if (qList->len > 1)
|
||||
@@ -1032,8 +1024,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
tupdesc = rel->rd_att;
|
||||
|
||||
relid = heap_create_with_catalog(
|
||||
child->nodeElem->outTypes->val[0],
|
||||
tupdesc, RELKIND_RELATION);
|
||||
child->nodeElem->outTypes->val[0],
|
||||
tupdesc, RELKIND_RELATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1056,8 +1048,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
else
|
||||
{
|
||||
relid = heap_create_with_catalog(
|
||||
child->nodeElem->outTypes->val[0],
|
||||
tupdesc, RELKIND_RELATION);
|
||||
child->nodeElem->outTypes->val[0],
|
||||
tupdesc, RELKIND_RELATION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1338,4 +1330,4 @@ replaceTeeScans(Plan *plan, Query *parsetree, TeeInfo * teeInfo)
|
||||
|
||||
|
||||
|
||||
#endif /* TIOGA */
|
||||
#endif /* TIOGA */
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.28 1998/09/01 03:22:02 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.29 1998/09/01 04:27:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -57,7 +57,7 @@ RemoveOperator(char *operatorName, /* operator name */
|
||||
bool defined;
|
||||
char *userName;
|
||||
char oprtype;
|
||||
|
||||
|
||||
if (typeName1)
|
||||
{
|
||||
typeId1 = TypeGet(typeName1, &defined);
|
||||
@@ -86,11 +86,11 @@ RemoveOperator(char *operatorName, /* operator name */
|
||||
oprtype = 'r';
|
||||
|
||||
tup = SearchSysCacheTupleCopy(OPRNAME,
|
||||
PointerGetDatum(operatorName),
|
||||
ObjectIdGetDatum(typeId1),
|
||||
ObjectIdGetDatum(typeId2),
|
||||
CharGetDatum(oprtype));
|
||||
|
||||
PointerGetDatum(operatorName),
|
||||
ObjectIdGetDatum(typeId1),
|
||||
ObjectIdGetDatum(typeId2),
|
||||
CharGetDatum(oprtype));
|
||||
|
||||
relation = heap_openr(OperatorRelationName);
|
||||
if (HeapTupleIsValid(tup))
|
||||
{
|
||||
@@ -150,7 +150,7 @@ SingleOpOperatorRemove(Oid typeOid)
|
||||
int i;
|
||||
|
||||
ScanKeyEntryInitialize(&key[0],
|
||||
0, 0, F_OIDEQ, (Datum) typeOid);
|
||||
0, 0, F_OIDEQ, (Datum) typeOid);
|
||||
rel = heap_openr(OperatorRelationName);
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
@@ -192,7 +192,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
||||
*/
|
||||
|
||||
ScanKeyEntryInitialize(&key[0],
|
||||
0, 3, F_OIDEQ, (Datum) typeOid);
|
||||
0, 3, F_OIDEQ, (Datum) typeOid);
|
||||
|
||||
oidptr = (struct oidlist *) palloc(sizeof(*oidptr));
|
||||
oidptr->next = NULL;
|
||||
@@ -232,7 +232,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
||||
heap_close(rel);
|
||||
}
|
||||
|
||||
#endif /* NOTYET */
|
||||
#endif /* NOTYET */
|
||||
|
||||
/*
|
||||
* TypeRemove
|
||||
@@ -257,15 +257,15 @@ RemoveType(char *typeName) /* type name to be removed */
|
||||
|
||||
relation = heap_openr(TypeRelationName);
|
||||
tup = SearchSysCacheTuple(TYPNAME,
|
||||
PointerGetDatum(typeName),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(typeName),
|
||||
0, 0, 0);
|
||||
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
heap_close(relation);
|
||||
elog(ERROR, "RemoveType: type '%s' does not exist", typeName);
|
||||
}
|
||||
|
||||
|
||||
relation = heap_openr(TypeRelationName);
|
||||
typeOid = tup->t_oid;
|
||||
heap_delete(relation, &tup->t_ctid);
|
||||
@@ -273,8 +273,8 @@ RemoveType(char *typeName) /* type name to be removed */
|
||||
/* Now, Delete the "array of" that type */
|
||||
shadow_type = makeArrayTypeName(typeName);
|
||||
tup = SearchSysCacheTuple(TYPNAME,
|
||||
PointerGetDatum(shadow_type),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(shadow_type),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
heap_close(relation);
|
||||
@@ -308,7 +308,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
|
||||
char *typename;
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
MemSet(argList, 0, 8 * sizeof(Oid));
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
@@ -340,10 +340,10 @@ RemoveFunction(char *functionName, /* function name to be removed */
|
||||
|
||||
relation = heap_openr(ProcedureRelationName);
|
||||
tup = SearchSysCacheTuple(PRONAME,
|
||||
PointerGetDatum(functionName),
|
||||
Int32GetDatum(nargs),
|
||||
PointerGetDatum(argList),
|
||||
0);
|
||||
PointerGetDatum(functionName),
|
||||
Int32GetDatum(nargs),
|
||||
PointerGetDatum(argList),
|
||||
0);
|
||||
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
@@ -353,8 +353,8 @@ RemoveFunction(char *functionName, /* function name to be removed */
|
||||
|
||||
if ((((Form_pg_proc) GETSTRUCT(tup))->prolang) == INTERNALlanguageId)
|
||||
{
|
||||
heap_close(relation);
|
||||
elog(ERROR, "RemoveFunction: function \"%s\" is built-in",functionName);
|
||||
heap_close(relation);
|
||||
elog(ERROR, "RemoveFunction: function \"%s\" is built-in", functionName);
|
||||
}
|
||||
|
||||
heap_delete(relation, &tup->t_ctid);
|
||||
@@ -410,9 +410,9 @@ RemoveAggregate(char *aggName, char *aggType)
|
||||
|
||||
relation = heap_openr(AggregateRelationName);
|
||||
tup = SearchSysCacheTuple(AGGNAME,
|
||||
PointerGetDatum(aggName),
|
||||
ObjectIdGetDatum(basetypeID),
|
||||
0, 0);
|
||||
PointerGetDatum(aggName),
|
||||
ObjectIdGetDatum(basetypeID),
|
||||
0, 0);
|
||||
|
||||
if (!HeapTupleIsValid(tup))
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.16 1998/09/01 03:22:04 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.17 1998/09/01 04:27:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <optimizer/prep.h> /* for find_all_inheritors */
|
||||
#ifndef NO_SECURITY
|
||||
#include <utils/acl.h>
|
||||
#endif /* !NO_SECURITY */
|
||||
#endif /* !NO_SECURITY */
|
||||
#ifndef HAVE_MEMMOVE
|
||||
#include <regex/utils.h>
|
||||
#else
|
||||
@@ -73,7 +73,7 @@ renameatt(char *relname,
|
||||
newatttup;
|
||||
Relation irelations[Num_pg_attr_indices];
|
||||
Oid relid;
|
||||
|
||||
|
||||
/*
|
||||
* permissions checking. this would normally be done in utility.c,
|
||||
* but this particular routine is recursive.
|
||||
@@ -111,12 +111,10 @@ renameatt(char *relname,
|
||||
0, 0, 0);
|
||||
|
||||
if (!HeapTupleIsValid(reltup))
|
||||
{
|
||||
elog(ERROR, "renameatt: unknown relation: \"%s\"", relname);
|
||||
}
|
||||
|
||||
myrelid = reltup->t_oid;
|
||||
|
||||
|
||||
/* this routine is actually in the planner */
|
||||
children = find_all_inheritors(lconsi(myrelid, NIL), NIL);
|
||||
|
||||
@@ -127,7 +125,7 @@ renameatt(char *relname,
|
||||
*/
|
||||
foreach(child, children)
|
||||
{
|
||||
char childname[NAMEDATALEN];
|
||||
char childname[NAMEDATALEN];
|
||||
|
||||
childrelid = lfirsti(child);
|
||||
if (childrelid == myrelid)
|
||||
@@ -142,10 +140,10 @@ renameatt(char *relname,
|
||||
}
|
||||
/* make copy of cache value, could disappear in call */
|
||||
StrNCpy(childname,
|
||||
((Form_pg_class) GETSTRUCT(reltup))->relname.data,
|
||||
NAMEDATALEN);
|
||||
((Form_pg_class) GETSTRUCT(reltup))->relname.data,
|
||||
NAMEDATALEN);
|
||||
/* no more recursion! */
|
||||
renameatt(childname, oldattname, newattname, userName, 0);
|
||||
renameatt(childname, oldattname, newattname, userName, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,9 +156,9 @@ renameatt(char *relname,
|
||||
relid = reltup->t_oid;
|
||||
|
||||
oldatttup = SearchSysCacheTupleCopy(ATTNAME,
|
||||
ObjectIdGetDatum(relid),
|
||||
PointerGetDatum(oldattname),
|
||||
0, 0);
|
||||
ObjectIdGetDatum(relid),
|
||||
PointerGetDatum(oldattname),
|
||||
0, 0);
|
||||
if (!HeapTupleIsValid(oldatttup))
|
||||
elog(ERROR, "renameatt: attribute \"%s\" nonexistent", oldattname);
|
||||
|
||||
@@ -168,9 +166,9 @@ renameatt(char *relname,
|
||||
elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname);
|
||||
|
||||
newatttup = SearchSysCacheTuple(ATTNAME,
|
||||
ObjectIdGetDatum(relid),
|
||||
PointerGetDatum(newattname),
|
||||
0, 0);
|
||||
ObjectIdGetDatum(relid),
|
||||
PointerGetDatum(newattname),
|
||||
0, 0);
|
||||
/* should not already exist */
|
||||
if (HeapTupleIsValid(newatttup))
|
||||
{
|
||||
@@ -179,7 +177,7 @@ renameatt(char *relname,
|
||||
}
|
||||
|
||||
StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
|
||||
newattname, NAMEDATALEN);
|
||||
newattname, NAMEDATALEN);
|
||||
|
||||
attrelation = heap_openr(AttributeRelationName);
|
||||
heap_replace(attrelation, &oldatttup->t_ctid, oldatttup);
|
||||
@@ -212,13 +210,13 @@ renameatt(char *relname,
|
||||
void
|
||||
renamerel(char *oldrelname, char *newrelname)
|
||||
{
|
||||
Relation relrelation; /* for RELATION relation */
|
||||
Relation relrelation; /* for RELATION relation */
|
||||
HeapTuple oldreltup,
|
||||
newreltup;
|
||||
char oldpath[MAXPGPATH],
|
||||
newpath[MAXPGPATH];
|
||||
Relation irelations[Num_pg_class_indices];
|
||||
|
||||
|
||||
if (IsSystemRelationName(oldrelname))
|
||||
elog(ERROR, "renamerel: system relation \"%s\" not renamed",
|
||||
oldrelname);
|
||||
@@ -228,14 +226,14 @@ renamerel(char *oldrelname, char *newrelname)
|
||||
newrelname);
|
||||
|
||||
oldreltup = SearchSysCacheTupleCopy(RELNAME,
|
||||
PointerGetDatum(oldrelname),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(oldrelname),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(oldreltup))
|
||||
elog(ERROR, "renamerel: relation \"%s\" does not exist", oldrelname);
|
||||
|
||||
newreltup = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(newrelname),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(newrelname),
|
||||
0, 0, 0);
|
||||
if (HeapTupleIsValid(newreltup))
|
||||
elog(ERROR, "renamerel: relation \"%s\" exists", newrelname);
|
||||
|
||||
@@ -246,7 +244,7 @@ renamerel(char *oldrelname, char *newrelname)
|
||||
elog(ERROR, "renamerel: unable to rename file: %s", oldpath);
|
||||
|
||||
StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data),
|
||||
newrelname, NAMEDATALEN);
|
||||
newrelname, NAMEDATALEN);
|
||||
|
||||
/* insert fixed rel tuple */
|
||||
relrelation = heap_openr(RelationRelationName);
|
||||
|
@@ -316,9 +316,9 @@ currval(struct varlena * seqin)
|
||||
int4
|
||||
setval(struct varlena * seqin, int4 next)
|
||||
{
|
||||
char *seqname = textout(seqin);
|
||||
char *seqname = textout(seqin);
|
||||
SeqTable elm;
|
||||
Buffer buf;
|
||||
Buffer buf;
|
||||
Form_pg_sequence seq;
|
||||
ItemPointerData iptr;
|
||||
|
||||
@@ -329,17 +329,20 @@ setval(struct varlena * seqin, int4 next)
|
||||
#endif
|
||||
|
||||
/* open and WIntentLock sequence */
|
||||
elm = init_sequence ("setval", seqname);
|
||||
seq = read_info ("setval", elm, &buf); /* lock page and read tuple */
|
||||
elm = init_sequence("setval", seqname);
|
||||
seq = read_info("setval", elm, &buf); /* lock page and read
|
||||
* tuple */
|
||||
|
||||
if ( seq->cache_value != 1 ) {
|
||||
elog (ERROR, "%s.setval: can't set value of sequence %s, cache != 1",
|
||||
seqname, seqname);
|
||||
if (seq->cache_value != 1)
|
||||
{
|
||||
elog(ERROR, "%s.setval: can't set value of sequence %s, cache != 1",
|
||||
seqname, seqname);
|
||||
}
|
||||
|
||||
if ((next < seq->min_value) || (next > seq->max_value)) {
|
||||
elog (ERROR, "%s.setval: value %d is of of bounds (%d,%d)",
|
||||
seqname, next, seq->min_value, seq->max_value);
|
||||
if ((next < seq->min_value) || (next > seq->max_value))
|
||||
{
|
||||
elog(ERROR, "%s.setval: value %d is of of bounds (%d,%d)",
|
||||
seqname, next, seq->min_value, seq->max_value);
|
||||
}
|
||||
|
||||
/* save info in local cache */
|
||||
@@ -350,11 +353,11 @@ setval(struct varlena * seqin, int4 next)
|
||||
seq->last_value = next; /* last fetched number */
|
||||
seq->is_called = 't';
|
||||
|
||||
if ( WriteBuffer (buf) == STATUS_ERROR )
|
||||
elog (ERROR, "%s.settval: WriteBuffer failed", seqname);
|
||||
if (WriteBuffer(buf) == STATUS_ERROR)
|
||||
elog(ERROR, "%s.settval: WriteBuffer failed", seqname);
|
||||
|
||||
ItemPointerSet(&iptr, 0, FirstOffsetNumber);
|
||||
RelationUnsetSingleWLockPage (elm->rel, &iptr);
|
||||
RelationUnsetSingleWLockPage(elm->rel, &iptr);
|
||||
|
||||
return next;
|
||||
}
|
||||
|
@@ -40,8 +40,7 @@ void RelationBuildTriggers(Relation relation);
|
||||
void FreeTriggerDesc(Relation relation);
|
||||
|
||||
static void DescribeTrigger(TriggerDesc *trigdesc, Trigger *trigger);
|
||||
static HeapTuple
|
||||
GetTupleForTrigger(Relation relation, ItemPointer tid,
|
||||
static HeapTuple GetTupleForTrigger(Relation relation, ItemPointer tid,
|
||||
bool before);
|
||||
|
||||
extern GlobalMemory CacheCxt;
|
||||
@@ -220,8 +219,8 @@ CreateTrigger(CreateTrigStmt *stmt)
|
||||
|
||||
/* update pg_class */
|
||||
tuple = SearchSysCacheTupleCopy(RELNAME,
|
||||
PointerGetDatum(stmt->relname),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(stmt->relname),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "CreateTrigger: relation %s not found in pg_class", stmt->relname);
|
||||
|
||||
@@ -258,7 +257,7 @@ DropTrigger(DropTrigStmt *stmt)
|
||||
MemoryContext oldcxt;
|
||||
int found = 0;
|
||||
int tgfound = 0;
|
||||
|
||||
|
||||
#ifndef NO_SECURITY
|
||||
if (!pg_ownercheck(GetPgUserName(), stmt->relname, RELNAME))
|
||||
elog(ERROR, "%s: %s", stmt->relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
|
||||
@@ -298,8 +297,8 @@ DropTrigger(DropTrigStmt *stmt)
|
||||
heap_close(tgrel);
|
||||
|
||||
tuple = SearchSysCacheTupleCopy(RELNAME,
|
||||
PointerGetDatum(stmt->relname),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(stmt->relname),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "DropTrigger: relation %s not found in pg_class", stmt->relname);
|
||||
|
||||
|
@@ -263,7 +263,7 @@ AlterUser(AlterUserStmt *stmt)
|
||||
{
|
||||
RelationUnsetLockForWrite(pg_shadow_rel);
|
||||
heap_close(pg_shadow_rel);
|
||||
UserAbortTransactionBlock(); /* needed? */
|
||||
UserAbortTransactionBlock(); /* needed? */
|
||||
elog(ERROR, "alterUser: user \"%s\" does not exist", stmt->user);
|
||||
return;
|
||||
}
|
||||
@@ -430,8 +430,8 @@ RemoveUser(char *user)
|
||||
* tables, views, etc owned by the user.
|
||||
*
|
||||
* The second option would be to create a means of deleting tables, view,
|
||||
* etc. owned by the user from other databases. pg_shadow is global and
|
||||
* so this must be done at some point.
|
||||
* etc. owned by the user from other databases. pg_shadow is global
|
||||
* and so this must be done at some point.
|
||||
*
|
||||
* Let us not forget that the user should be removed from the pg_groups
|
||||
* also.
|
||||
@@ -466,8 +466,8 @@ CheckPgUserAclNotNull()
|
||||
HeapTuple htup;
|
||||
|
||||
htup = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(ShadowRelationName),
|
||||
0, 0, 0);
|
||||
PointerGetDatum(ShadowRelationName),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(htup))
|
||||
{
|
||||
elog(ERROR, "IsPgUserAclNull: class \"%s\" not found",
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.79 1998/09/01 03:22:08 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.80 1998/09/01 04:28:05 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -288,7 +288,7 @@ vc_getrels(NameData *VacRelP)
|
||||
else
|
||||
{
|
||||
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relkind,
|
||||
F_CHAREQ, CharGetDatum('r'));
|
||||
F_CHAREQ, CharGetDatum('r'));
|
||||
}
|
||||
|
||||
portalmem = PortalGetVariableMemory(vc_portal);
|
||||
@@ -377,16 +377,16 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
HeapTuple tuple,
|
||||
typetuple;
|
||||
Relation onerel;
|
||||
VPageListData vacuum_pages; /* List of pages to vacuum and/or clean
|
||||
VPageListData vacuum_pages; /* List of pages to vacuum and/or clean
|
||||
* indices */
|
||||
VPageListData fraged_pages; /* List of pages with space enough for
|
||||
VPageListData fraged_pages; /* List of pages with space enough for
|
||||
* re-using */
|
||||
VPageDescr *vpp;
|
||||
Relation *Irel;
|
||||
int32 nindices,
|
||||
i;
|
||||
VRelStats *vacrelstats;
|
||||
|
||||
|
||||
StartTransactionCommand();
|
||||
|
||||
rel = heap_openr(RelationRelationName);
|
||||
@@ -397,8 +397,8 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
* last time we saw it, we don't need to vacuum it.
|
||||
*/
|
||||
tuple = SearchSysCacheTuple(RELOID,
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
heap_close(rel);
|
||||
@@ -499,8 +499,8 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
stats->f_cmpgt.fn_addr = NULL;
|
||||
|
||||
typetuple = SearchSysCacheTuple(TYPOID,
|
||||
ObjectIdGetDatum(stats->attr->atttypid),
|
||||
0, 0, 0);
|
||||
ObjectIdGetDatum(stats->attr->atttypid),
|
||||
0, 0, 0);
|
||||
if (HeapTupleIsValid(typetuple))
|
||||
stats->outfunc = ((Form_pg_type) GETSTRUCT(typetuple))->typoutput;
|
||||
else
|
||||
@@ -549,13 +549,14 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
}
|
||||
}
|
||||
|
||||
if (fraged_pages.vpl_num_pages > 0) /* Try to shrink heap */
|
||||
if (fraged_pages.vpl_num_pages > 0) /* Try to shrink heap */
|
||||
vc_rpfheap(vacrelstats, onerel, &vacuum_pages, &fraged_pages, nindices, Irel);
|
||||
else
|
||||
{
|
||||
if (Irel != (Relation *) NULL)
|
||||
vc_clsindices(nindices, Irel);
|
||||
if (vacuum_pages.vpl_num_pages > 0)/* Clean pages from vacuum_pages list */
|
||||
if (vacuum_pages.vpl_num_pages > 0) /* Clean pages from
|
||||
* vacuum_pages list */
|
||||
vc_vacheap(vacrelstats, onerel, &vacuum_pages);
|
||||
}
|
||||
|
||||
@@ -644,7 +645,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
|
||||
vpc->vpd_offsets_used = 0;
|
||||
|
||||
elog(MESSAGE_LEVEL, "--Relation %s--", relname);
|
||||
|
||||
|
||||
for (blkno = 0; blkno < nblocks; blkno++)
|
||||
{
|
||||
buf = ReadBuffer(onerel, blkno);
|
||||
@@ -875,8 +876,8 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
|
||||
fraged_pages->vpl_empty_end_pages = empty_end_pages;
|
||||
|
||||
/*
|
||||
* Try to make fraged_pages keeping in mind that we can't use free space of
|
||||
* "empty" end-pages and last page if it reapped.
|
||||
* Try to make fraged_pages keeping in mind that we can't use free
|
||||
* space of "empty" end-pages and last page if it reapped.
|
||||
*/
|
||||
if (do_shrinking && vacuum_pages->vpl_num_pages - empty_end_pages > 0)
|
||||
{
|
||||
@@ -1010,9 +1011,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
isempty = PageIsEmpty(page);
|
||||
|
||||
dowrite = false;
|
||||
if (blkno == last_vacuum_block) /* it's reapped page */
|
||||
if (blkno == last_vacuum_block) /* it's reapped page */
|
||||
{
|
||||
if (last_vacuum_page->vpd_offsets_free > 0) /* there are dead tuples */
|
||||
if (last_vacuum_page->vpd_offsets_free > 0) /* there are dead tuples */
|
||||
{ /* on this page - clean */
|
||||
Assert(!isempty);
|
||||
vc_vacpage(page, last_vacuum_page);
|
||||
@@ -1025,7 +1026,8 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
/* get prev reapped page from vacuum_pages */
|
||||
last_vacuum_page = vacuum_pages->vpl_pagedesc[vacuumed_pages - 1];
|
||||
last_vacuum_block = last_vacuum_page->vpd_blkno;
|
||||
if (blkno == last_fraged_block) /* this page in fraged_pages too */
|
||||
if (blkno == last_fraged_block) /* this page in
|
||||
* fraged_pages too */
|
||||
{
|
||||
--num_fraged_pages;
|
||||
Assert(num_fraged_pages > 0);
|
||||
@@ -1080,7 +1082,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
Assert(num_fraged_pages > cur_item + 1);
|
||||
memmove(fraged_pages->vpl_pagedesc + cur_item,
|
||||
fraged_pages->vpl_pagedesc + cur_item + 1,
|
||||
sizeof(VPageDescr *) * (num_fraged_pages - cur_item - 1));
|
||||
sizeof(VPageDescr *) * (num_fraged_pages - cur_item - 1));
|
||||
num_fraged_pages--;
|
||||
Assert(last_fraged_page == fraged_pages->vpl_pagedesc[num_fraged_pages - 1]);
|
||||
}
|
||||
@@ -1121,7 +1123,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
elog(ERROR, "\
|
||||
failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
|
||||
tuple_len, cur_page->vpd_blkno, cur_page->vpd_free,
|
||||
cur_page->vpd_offsets_used, cur_page->vpd_offsets_free);
|
||||
cur_page->vpd_offsets_used, cur_page->vpd_offsets_free);
|
||||
}
|
||||
newitemid = PageGetItemId(ToPage, newoff);
|
||||
pfree(newtup);
|
||||
@@ -1145,7 +1147,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
|
||||
for (i = 0, idcur = Idesc; i < nindices; i++, idcur++)
|
||||
{
|
||||
FormIndexDatum(idcur->natts,
|
||||
(AttrNumber *) &(idcur->tform->indkey[0]),
|
||||
(AttrNumber *) &(idcur->tform->indkey[0]),
|
||||
newtup,
|
||||
tupdesc,
|
||||
idatum,
|
||||
@@ -1201,8 +1203,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean uncleaned reapped pages from vacuum_pages list and set xmin committed
|
||||
* for inserted tuples
|
||||
* Clean uncleaned reapped pages from vacuum_pages list and set xmin
|
||||
* committed for inserted tuples
|
||||
*/
|
||||
checked_moved = 0;
|
||||
for (i = 0, vpp = vacuum_pages->vpl_pagedesc; i < vacuumed_pages; i++, vpp++)
|
||||
@@ -1320,7 +1322,7 @@ Elapsed %u/%u sec.",
|
||||
elog(FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i);
|
||||
blkno = smgrtruncate(DEFAULT_SMGR, onerel, blkno);
|
||||
Assert(blkno >= 0);
|
||||
vacrelstats->num_pages = blkno; /* set new number of blocks */
|
||||
vacrelstats->num_pages = blkno; /* set new number of blocks */
|
||||
}
|
||||
|
||||
if (Irel != (Relation *) NULL) /* pfree index' allocations */
|
||||
@@ -1351,7 +1353,8 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
|
||||
int i;
|
||||
|
||||
nblocks = vacuum_pages->vpl_num_pages;
|
||||
nblocks -= vacuum_pages->vpl_empty_end_pages;/* nothing to do with them */
|
||||
nblocks -= vacuum_pages->vpl_empty_end_pages; /* nothing to do with
|
||||
* them */
|
||||
|
||||
for (i = 0, vpp = vacuum_pages->vpl_pagedesc; i < nblocks; i++, vpp++)
|
||||
{
|
||||
@@ -1385,7 +1388,8 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
|
||||
|
||||
nblocks = smgrtruncate(DEFAULT_SMGR, onerel, nblocks);
|
||||
Assert(nblocks >= 0);
|
||||
vacrelstats->num_pages = nblocks; /* set new number of blocks */
|
||||
vacrelstats->num_pages = nblocks; /* set new number of
|
||||
* blocks */
|
||||
}
|
||||
|
||||
} /* vc_vacheap */
|
||||
@@ -1555,7 +1559,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
|
||||
|
||||
vp = &vpd;
|
||||
vpp = (VPageDescr *) vc_find_eq((char *) (vpl->vpl_pagedesc),
|
||||
vpl->vpl_num_pages, sizeof(VPageDescr), (char *) &vp,
|
||||
vpl->vpl_num_pages, sizeof(VPageDescr), (char *) &vp,
|
||||
vc_cmp_blk);
|
||||
|
||||
if (vpp == (VPageDescr *) NULL)
|
||||
@@ -1570,7 +1574,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
|
||||
}
|
||||
|
||||
voff = (OffsetNumber *) vc_find_eq((char *) (vp->vpd_offsets),
|
||||
vp->vpd_offsets_free, sizeof(OffsetNumber), (char *) &ioffno,
|
||||
vp->vpd_offsets_free, sizeof(OffsetNumber), (char *) &ioffno,
|
||||
vc_cmp_offno);
|
||||
|
||||
if (voff == (OffsetNumber *) NULL)
|
||||
@@ -1746,16 +1750,16 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
|
||||
ScanKeyData askey;
|
||||
Form_pg_attribute attp;
|
||||
Buffer buffer;
|
||||
|
||||
|
||||
/*
|
||||
* update number of tuples and number of pages in pg_class
|
||||
*/
|
||||
rtup = SearchSysCacheTuple(RELOID,
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(rtup))
|
||||
elog(ERROR, "pg_class entry for relid %d vanished during vacuuming",
|
||||
relid);
|
||||
relid);
|
||||
|
||||
rd = heap_openr(RelationRelationName);
|
||||
|
||||
@@ -2207,16 +2211,20 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
|
||||
AttrNumber *attnumP;
|
||||
int natts;
|
||||
int i;
|
||||
|
||||
|
||||
*Idesc = (IndDesc *) palloc(nindices * sizeof(IndDesc));
|
||||
|
||||
for (i = 0, idcur = *Idesc; i < nindices; i++, idcur++)
|
||||
{
|
||||
cachetuple = SearchSysCacheTupleCopy(INDEXRELID,
|
||||
ObjectIdGetDatum(RelationGetRelid(Irel[i])),
|
||||
0, 0, 0);
|
||||
ObjectIdGetDatum(RelationGetRelid(Irel[i])),
|
||||
0, 0, 0);
|
||||
Assert(cachetuple);
|
||||
/* we never free the copy we make, because Idesc needs it for later */
|
||||
|
||||
/*
|
||||
* we never free the copy we make, because Idesc needs it for
|
||||
* later
|
||||
*/
|
||||
idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple);
|
||||
for (attnumP = &(idcur->tform->indkey[0]), natts = 0;
|
||||
*attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS;
|
||||
@@ -2247,7 +2255,8 @@ vc_enough_space(VPageDescr vpd, Size len)
|
||||
if (len > vpd->vpd_free)
|
||||
return false;
|
||||
|
||||
if (vpd->vpd_offsets_used < vpd->vpd_offsets_free) /* there are free itemid(s) */
|
||||
if (vpd->vpd_offsets_used < vpd->vpd_offsets_free) /* there are free
|
||||
* itemid(s) */
|
||||
return true; /* and len <= free_space */
|
||||
|
||||
/* ok. noff_usd >= noff_free and so we'll have to allocate new itemid */
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* Routines for handling of 'SET var TO',
|
||||
* 'SHOW var' and 'RESET var' statements.
|
||||
*
|
||||
* $Id: variable.c,v 1.11 1998/09/01 03:22:10 momjian Exp $
|
||||
* $Id: variable.c,v 1.12 1998/09/01 04:28:07 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -554,7 +554,7 @@ struct VariableParsers
|
||||
{
|
||||
"client_encoding", parse_client_encoding, show_client_encoding, reset_client_encoding
|
||||
},
|
||||
{
|
||||
{
|
||||
"server_encoding", parse_server_encoding, show_server_encoding, reset_server_encoding
|
||||
},
|
||||
#endif
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.24 1998/08/06 05:12:30 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.25 1998/09/01 04:28:10 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
|
||||
OffsetVarNodes(viewParse->qual, 2);
|
||||
|
||||
OffsetVarNodes(viewParse->havingQual, 2);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* find the old range table...
|
||||
|
Reference in New Issue
Block a user