mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-28 00:51:50 +02:00
Cleanup for NAMEDATALEN use.
This commit is contained in:
parent
ea210dc611
commit
6ed1715b1f
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.11 1996/11/05 07:42:46 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.12 1997/08/03 02:34:19 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the executor utility code such as "ExecTypeFromTL" should be
|
||||
@ -328,7 +328,7 @@ BuildDescForRelation(List *schema, char *relname)
|
||||
|
||||
attnum = 0;
|
||||
|
||||
typename = palloc(NAMEDATALEN+1);
|
||||
typename = palloc(NAMEDATALEN);
|
||||
|
||||
foreach(p, schema) {
|
||||
ColumnDef *entry;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.13 1997/03/10 00:18:09 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.14 1997/08/03 02:34:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -456,8 +456,8 @@ Async_Listen(char *relname, int pid)
|
||||
* to unlisten prior to dying.
|
||||
*/
|
||||
relnamei = malloc(NAMEDATALEN); /* persists to process exit */
|
||||
memset (relnamei, 0, NAMEDATALEN);
|
||||
strncpy(relnamei, relname, NAMEDATALEN);
|
||||
relnamei[NAMEDATALEN-1] = '\0';
|
||||
on_exitpg(Async_UnlistenOnExit, (caddr_t) relnamei);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.10 1997/01/10 20:17:05 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.11 1997/08/03 02:34:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -83,10 +83,10 @@ cluster(char oldrelname[], char oldindexname[])
|
||||
Relation OldHeap, OldIndex;
|
||||
Relation NewHeap;
|
||||
|
||||
char NewIndexName[NAMEDATALEN+1];
|
||||
char NewHeapName[NAMEDATALEN+1];
|
||||
char saveoldrelname[NAMEDATALEN+1];
|
||||
char saveoldindexname[NAMEDATALEN+1];
|
||||
char NewIndexName[NAMEDATALEN];
|
||||
char NewHeapName[NAMEDATALEN];
|
||||
char saveoldrelname[NAMEDATALEN];
|
||||
char saveoldindexname[NAMEDATALEN];
|
||||
|
||||
|
||||
/* Save the old names because they will get lost when the old relations
|
||||
@ -258,7 +258,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
|
||||
Old_pg_index_relation_Form =
|
||||
(Form_pg_class)GETSTRUCT(Old_pg_index_relation_Tuple);
|
||||
|
||||
NewIndexName = palloc(NAMEDATALEN+1); /* XXX */
|
||||
NewIndexName = palloc(NAMEDATALEN); /* XXX */
|
||||
sprintf(NewIndexName, "temp_%x", OIDOldIndex); /* Set the name. */
|
||||
|
||||
/*
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.7 1997/08/02 19:09:33 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.8 1997/08/03 02:34:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -46,7 +46,7 @@ static void StoreCatalogInheritance(Oid relationId, List *supers);
|
||||
void
|
||||
DefineRelation(CreateStmt *stmt)
|
||||
{
|
||||
char *relname = palloc(NAMEDATALEN+1);
|
||||
char *relname = palloc(NAMEDATALEN);
|
||||
List *schema = stmt->tableElts;
|
||||
int numberOfAttributes;
|
||||
Oid relationId;
|
||||
@ -58,11 +58,12 @@ DefineRelation(CreateStmt *stmt)
|
||||
|
||||
char* typename = NULL; /* the typename of this relation. not useod for now */
|
||||
|
||||
if ( strlen(stmt->relname) > NAMEDATALEN)
|
||||
elog(WARN, "the relation name %s is > %d characters long", stmt->relname,
|
||||
if ( strlen(stmt->relname) >= NAMEDATALEN)
|
||||
elog(WARN, "the relation name %s is >= %d characters long", stmt->relname,
|
||||
NAMEDATALEN);
|
||||
strncpy(relname,stmt->relname,NAMEDATALEN+1); /* make full length for copy */
|
||||
|
||||
strncpy(relname,stmt->relname,NAMEDATALEN); /* make full length for copy */
|
||||
relname[NAMEDATALEN-1] = '\0';
|
||||
|
||||
/* ----------------
|
||||
* Handle parameters
|
||||
* XXX parameter handling missing below.
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.11 1996/11/30 17:47:07 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.12 1997/08/03 02:35:01 momjian Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@ -187,7 +187,7 @@ CreateFunction(ProcedureStmt *stmt, CommandDest dest)
|
||||
/* SQL that executes this function, if any */
|
||||
char *prorettype;
|
||||
/* Type of return value (or member of set of values) from function */
|
||||
char languageName[NAMEDATALEN+1];
|
||||
char languageName[NAMEDATALEN];
|
||||
/* name of language of function, with case adjusted:
|
||||
"C", "internal", or "SQL"
|
||||
*/
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.3 1996/11/10 03:00:49 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.4 1997/08/03 02:35:13 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -350,14 +350,14 @@ print_plan_recursive (Plan* p, Query *parsetree, int indentLevel, char* label)
|
||||
RangeTblEntry *rte;
|
||||
rte = rt_fetch(((Scan*)p)->scanrelid, parsetree->rtable);
|
||||
strncpy(extraInfo, rte->relname, NAMEDATALEN);
|
||||
extraInfo[NAMEDATALEN] = '\0';
|
||||
extraInfo[NAMEDATALEN-1] = '\0';
|
||||
} else
|
||||
if (IsA(p,IndexScan)) {
|
||||
strncpy(extraInfo,
|
||||
((RangeTblEntry*)(nth(((IndexScan*)p)->scan.scanrelid - 1,
|
||||
parsetree->rtable)))->relname,
|
||||
NAMEDATALEN);
|
||||
extraInfo[NAMEDATALEN] = '\0';
|
||||
extraInfo[NAMEDATALEN-1] = '\0';
|
||||
} else
|
||||
extraInfo[0] = '\0';
|
||||
if (extraInfo[0] != '\0')
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.29 1997/07/30 04:42:26 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.30 1997/08/03 02:35:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1003,9 +1003,9 @@ makeTargetNames(ParseState *pstate, List *cols)
|
||||
for(i=0; i < numcol; i++) {
|
||||
Ident *id = makeNode(Ident);
|
||||
|
||||
id->name = palloc(NAMEDATALEN+1);
|
||||
id->name = palloc(NAMEDATALEN);
|
||||
strncpy(id->name, attr[i]->attname.data, NAMEDATALEN);
|
||||
id->name[NAMEDATALEN]='\0';
|
||||
id->name[NAMEDATALEN-1]='\0';
|
||||
id->indirection = NIL;
|
||||
id->isRel = false;
|
||||
if (tl == NIL)
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.48 1997/07/30 14:08:11 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.49 1997/08/03 02:36:01 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@ -625,7 +625,7 @@ ConnStartup(Port *port, int *status,
|
||||
char *errormsg, const int errormsg_len)
|
||||
{
|
||||
MsgType msgType;
|
||||
char namebuf[NAMEDATALEN + 1];
|
||||
char namebuf[NAMEDATALEN];
|
||||
int pid;
|
||||
PacketBuf *p;
|
||||
StartupInfo sp;
|
||||
@ -653,7 +653,7 @@ ConnStartup(Port *port, int *status,
|
||||
msgType = (MsgType) ntohl(port->buf.msgtype);
|
||||
|
||||
(void) strncpy(namebuf, sp.user, NAMEDATALEN);
|
||||
namebuf[NAMEDATALEN] = '\0';
|
||||
namebuf[NAMEDATALEN-1] = '\0';
|
||||
if (!namebuf[0]) {
|
||||
strncpy(errormsg,
|
||||
"No Postgres username specified in startup packet.",
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.14 1997/07/24 20:14:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.15 1997/08/03 02:36:22 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -167,8 +167,8 @@ mdunlink(Relation reln)
|
||||
** to do this.
|
||||
*/
|
||||
|
||||
memset(fname,0, NAMEDATALEN);
|
||||
strncpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
|
||||
fname[NAMEDATALEN-1] = '\0';
|
||||
|
||||
if (FileNameUnlink(fname) < 0)
|
||||
return (SM_FAIL);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.10 1997/07/24 20:15:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.11 1997/08/03 02:36:41 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -85,7 +85,7 @@ char *
|
||||
aclparse(char *s, AclItem *aip, unsigned *modechg)
|
||||
{
|
||||
HeapTuple htp;
|
||||
char name[NAMEDATALEN+1];
|
||||
char name[NAMEDATALEN];
|
||||
|
||||
Assert(s && aip && modechg);
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.2 1997/03/14 23:20:43 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.3 1997/08/03 02:36:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -39,8 +39,8 @@ NameData *namein(char *s)
|
||||
return(NULL);
|
||||
result = (NameData*) palloc(NAMEDATALEN);
|
||||
/* always keep it null-padded */
|
||||
memset(result->data, 0, NAMEDATALEN);
|
||||
(void) strncpy(result->data, s, NAMEDATALEN-1);
|
||||
(void) strncpy(result->data, s, NAMEDATALEN);
|
||||
result->data[NAMEDATALEN-1] = '\0';
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -145,8 +145,8 @@ namestrcpy(Name name, char *str)
|
||||
{
|
||||
if (!name || !str)
|
||||
return(-1);
|
||||
memset(name->data, 0, sizeof(NameData));
|
||||
(void) strncpy(name->data, str, NAMEDATALEN);
|
||||
name->data[NAMEDATALEN-1] = '\0';
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.2 1996/11/06 06:49:56 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.3 1997/08/03 02:37:08 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -35,7 +35,7 @@ oidnamein(char *inStr)
|
||||
if (*inptr) {
|
||||
oc->id = (Oid) pg_atoi(inStr, sizeof(Oid), ',');
|
||||
/* copy one less to ensure null-padding */
|
||||
strncpy(oc->name.data,++inptr,NAMEDATALEN-1);
|
||||
strncpy(oc->name.data,++inptr,NAMEDATALEN);
|
||||
/* namestrcpy(&oc->name, ++inptr); */
|
||||
}else
|
||||
elog(WARN, "Bad input data for type oidname");
|
||||
|
3
src/backend/utils/cache/relcache.c
vendored
3
src/backend/utils/cache/relcache.c
vendored
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.10 1997/07/28 00:56:04 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.11 1997/08/03 02:37:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1066,7 +1066,6 @@ RelationNameCacheGetRelation(char *relationName)
|
||||
|
||||
/* make sure that the name key used for hash lookup is properly
|
||||
null-padded */
|
||||
memset(&name,0, NAMEDATALEN);
|
||||
namestrcpy(&name, relationName);
|
||||
RelationNameCacheLookup(name.data, rd);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.80 1997/08/01 04:07:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.81 1997/08/03 02:37:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -835,7 +835,7 @@ do_copy(const char *args, PsqlSettings * settings)
|
||||
/* The direction of the copy is from a file to a table. */
|
||||
char file[MAXPATHLEN + 1];
|
||||
/* The pathname of the file from/to which we copy */
|
||||
char table[NAMEDATALEN + 1];
|
||||
char table[NAMEDATALEN];
|
||||
/* The name of the table from/to which we copy */
|
||||
bool syntax_error;
|
||||
/* The \c command has invalid syntax */
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: buf_internals.h,v 1.12 1997/03/28 07:06:48 scrappy Exp $
|
||||
* $Id: buf_internals.h,v 1.13 1997/08/03 02:38:25 momjian Exp $
|
||||
*
|
||||
* NOTE
|
||||
* If BUFFERPAGE0 is defined, then 0 will be used as a
|
||||
@ -118,10 +118,10 @@ struct sbufdesc_unpadded {
|
||||
#ifdef HAS_TEST_AND_SET
|
||||
slock_t io_in_progress_lock;
|
||||
#endif /* HAS_TEST_AND_SET */
|
||||
char sb_dbname[NAMEDATALEN+1];
|
||||
char sb_dbname[NAMEDATALEN];
|
||||
|
||||
/* NOTE NO PADDING OF THE MEMBER HERE */
|
||||
char sb_relname[NAMEDATALEN+1];
|
||||
char sb_relname[NAMEDATALEN];
|
||||
};
|
||||
|
||||
/* THE REAL STRUCTURE - the structure above must match it, minus sb_pad */
|
||||
@ -143,7 +143,7 @@ struct sbufdesc {
|
||||
slock_t io_in_progress_lock;
|
||||
#endif /* HAS_TEST_AND_SET */
|
||||
|
||||
char sb_dbname[NAMEDATALEN+1]; /* name of db in which buf belongs */
|
||||
char sb_dbname[NAMEDATALEN]; /* name of db in which buf belongs */
|
||||
|
||||
/*
|
||||
* I padded this structure to a power of 2 (PADDED_SBUFDESC_SIZE) because
|
||||
@ -159,7 +159,7 @@ struct sbufdesc {
|
||||
/* please, don't take the sizeof() this member and use it for
|
||||
something important */
|
||||
|
||||
char sb_relname[NAMEDATALEN+1+ /* name of reln */
|
||||
char sb_relname[NAMEDATALEN+ /* name of reln */
|
||||
PADDED_SBUFDESC_SIZE-sizeof(struct sbufdesc_unpadded)];
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/sql.l,v 1.3 1996/12/11 00:28:11 momjian Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/sql.l,v 1.4 1997/08/03 02:38:47 momjian Exp $
|
||||
.TH INTRODUCTION SQL 11/5/95 PostgreSQL PostgreSQL
|
||||
.SH "Section 4 \(em SQL Commands (COMMANDS)"
|
||||
.SH "General Information"
|
||||
@ -19,9 +19,9 @@ of the line e.g:
|
||||
.fi
|
||||
.SH "Names"
|
||||
.IR Names
|
||||
in SQL are sequences of not more than NAMEDATALEN alphanumeric characters,
|
||||
in SQL are sequences of less than NAMEDATALEN alphanumeric characters,
|
||||
starting with an alphabetic character. By default, NAMEDATALEN is set
|
||||
to 16, but at the time the system is built, NAMEDATALEN can be changed
|
||||
to 32, but at the time the system is built, NAMEDATALEN can be changed
|
||||
by changing the #ifdef in src/backend/include/postgres.h. Underscore
|
||||
(\*(lq_\*(rq) is considered an alphabetic character.
|
||||
.SH "Keywords"
|
||||
|
Loading…
Reference in New Issue
Block a user