Bug in CVS pg_dump against 7.0.x

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Bug in CVS pg_dump against 7.0.x
Дата
Msg-id 40A77F37.2020405@familyhealth.com.au
обсуждение исходный текст
Ответы Re: Bug in CVS pg_dump against 7.0.x  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
Hi,

I know 7.0.x is pretty old, but I'm wondering if we should fix this to
make it better for people upgrading.

If you create a table like this in 7.0.x:

CREATE TABLE address (
     first_name character varying(50) DEFAULT 'asdf' NOT NULL,
     last_name character varying(50) NOT NULL,
     address character varying(50),
     tesing character varying[]
);

The 7.5 pg_dump program will dump it like this:

CREATE TABLE address (
     first_name character varying(50) DEFAULT 'asdf' NOT NULL,
     last_name character varying(50) NOT NULL,
     address character varying(50),
     tesing _varchar
);

I have attached a patch that should fix it.  I haven't been able to
actually test it since my dev machine and the 7.0 machine I have access
to aren't connected - although it does compile.  The fix is based on the
7.0 psql code.

Chris
? src/bin/pg_dump/.deps
? src/bin/pg_dump/common.c.working
? src/bin/pg_dump/pg_dump
? src/bin/pg_dump/pg_dump.c.working
? src/bin/pg_dump/pg_dump.h.working
? src/bin/pg_dump/pg_dumpall
? src/bin/pg_dump/pg_restore
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.370
diff -c -r1.370 pg_dump.c
*** src/bin/pg_dump/pg_dump.c    24 Mar 2004 03:06:08 -0000    1.370
--- src/bin/pg_dump/pg_dump.c    16 May 2004 14:42:55 -0000
***************
*** 7726,7733 ****
--- 7726,7741 ----
  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"))
      {
***************
*** 7770,7775 ****
--- 7778,7787 ----
          appendPQExpBuffer(buf, "\"char\"");
      else
          appendPQExpBuffer(buf, "%s", fmtId(typname));
+
+     /* Append array qualifier for array types */
+     if (isarray)
+         appendPQExpBuffer(buf, "[]");

      result = strdup(buf->data);
      destroyPQExpBuffer(buf);

В списке pgsql-patches по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: pg_ctl patch to integrate apache's rotatelogs
Следующее
От: David Fetter
Дата:
Сообщение: Re: YA dollar quoting patch