Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5c82ccb

Browse files
committed
Use OIDCHARS:
Use OIDCHARS for oid character length, rather than '10', in tablespace code.
1 parent a8a198b commit 5c82ccb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/commands/tablespace.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.66 2010/01/05 21:53:58 rhaas Exp $
40+
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.67 2010/01/06 01:48:09 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -249,7 +249,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
249249
* '/<dboid>/<relid>.<nnn>' (XXX but do we ever form the whole path
250250
* explicitly? This may be overly conservative.)
251251
*/
252-
if (strlen(location) >= (MAXPGPATH - 1 - 10 - 1 - 10 - 1 - 10))
252+
if (strlen(location) >= (MAXPGPATH - 1 - OIDCHARS - 1 - OIDCHARS - 1 - OIDCHARS))
253253
ereport(ERROR,
254254
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
255255
errmsg("tablespace location \"%s\" is too long",
@@ -337,7 +337,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
337337
/*
338338
* All seems well, create the symlink
339339
*/
340-
linkloc = (char *) palloc(10 + 10 + 1);
340+
linkloc = (char *) palloc(OIDCHARS + OIDCHARS + 1);
341341
sprintf(linkloc, "pg_tblspc/%u", tablespaceoid);
342342

343343
if (symlink(location, linkloc) < 0)
@@ -553,7 +553,7 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
553553
char *subfile;
554554
struct stat st;
555555

556-
location = (char *) palloc(10 + 10 + 1);
556+
location = (char *) palloc(OIDCHARS + OIDCHARS + 1);
557557
sprintf(location, "pg_tblspc/%u", tablespaceoid);
558558

559559
/*
@@ -1373,7 +1373,7 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
13731373
set_short_version(location);
13741374

13751375
/* Create the symlink if not already present */
1376-
linkloc = (char *) palloc(10 + 10 + 1);
1376+
linkloc = (char *) palloc(OIDCHARS + OIDCHARS + 1);
13771377
sprintf(linkloc, "pg_tblspc/%u", xlrec->ts_id);
13781378

13791379
if (symlink(location, linkloc) < 0)

0 commit comments

Comments
 (0)