From 5c82ccb1ddfc34d18de849cf6e5b2482887a87e2 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 6 Jan 2010 01:48:09 +0000
Subject: [PATCH] Use OIDCHARS:

Use OIDCHARS for oid character length, rather than '10', in tablespace
code.
---
 src/backend/commands/tablespace.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 0da15569f36..ad7d6662ec9 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.66 2010/01/05 21:53:58 rhaas Exp $
+ *	  $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.67 2010/01/06 01:48:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -249,7 +249,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
 	 * '/<dboid>/<relid>.<nnn>'  (XXX but do we ever form the whole path
 	 * explicitly?	This may be overly conservative.)
 	 */
-	if (strlen(location) >= (MAXPGPATH - 1 - 10 - 1 - 10 - 1 - 10))
+	if (strlen(location) >= (MAXPGPATH - 1 - OIDCHARS - 1 - OIDCHARS - 1 - OIDCHARS))
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
 				 errmsg("tablespace location \"%s\" is too long",
@@ -337,7 +337,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
 	/*
 	 * All seems well, create the symlink
 	 */
-	linkloc = (char *) palloc(10 + 10 + 1);
+	linkloc = (char *) palloc(OIDCHARS + OIDCHARS + 1);
 	sprintf(linkloc, "pg_tblspc/%u", tablespaceoid);
 
 	if (symlink(location, linkloc) < 0)
@@ -553,7 +553,7 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
 	char	   *subfile;
 	struct stat st;
 
-	location = (char *) palloc(10 + 10 + 1);
+	location = (char *) palloc(OIDCHARS + OIDCHARS + 1);
 	sprintf(location, "pg_tblspc/%u", tablespaceoid);
 
 	/*
@@ -1373,7 +1373,7 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
 		set_short_version(location);
 
 		/* Create the symlink if not already present */
-		linkloc = (char *) palloc(10 + 10 + 1);
+		linkloc = (char *) palloc(OIDCHARS + OIDCHARS + 1);
 		sprintf(linkloc, "pg_tblspc/%u", xlrec->ts_id);
 
 		if (symlink(location, linkloc) < 0)
-- 
GitLab