]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
[ Backpatch to 7.4.X.]
authorBruce Momjian <bruce@momjian.us>
Wed, 26 May 2004 18:27:23 +0000 (18:27 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 26 May 2004 18:27:23 +0000 (18:27 +0000)
Fix problem with doing 7.0.X dumps on character varying[] fields.

Christopher Kings-Lynne

src/bin/pg_dump/pg_dump.c

index 1ebe39a25b48f9b5510f82d220353b8d9fffaedb..ede8ad7c3a6c6eef3e61bee639557d29690168cd 100644 (file)
@@ -12,7 +12,7 @@
  *     by PostgreSQL
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355.2.4 2004/03/02 21:14:59 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.355.2.5 2004/05/26 18:27:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -6818,8 +6818,16 @@ static char *
 myFormatType(const char *typname, int32 typmod)
 {
        char       *result;
+       bool    isarray = false;
        PQExpBuffer buf = createPQExpBuffer();
 
+       /* Handle array types */
+       if (typname[0] == '_')
+       {
+               isarray = true;
+               typname++;
+       }
+
        /* Show lengths on bpchar and varchar */
        if (!strcmp(typname, "bpchar"))
        {
@@ -6863,6 +6871,10 @@ myFormatType(const char *typname, int32 typmod)
        else
                appendPQExpBuffer(buf, "%s", fmtId(typname));
 
+       /* Append array qualifier for array types */
+       if (isarray)
+               appendPQExpBuffer(buf, "[]");
+
        result = strdup(buf->data);
        destroyPQExpBuffer(buf);