nitpick consistency patch for pg_dump.c - Mailing list pgsql-patches

From Andrew Dunstan
Subject nitpick consistency patch for pg_dump.c
Date
Msg-id 54578.199.90.235.43.1058555723.squirrel@www.dunslane.net
Whole thread Raw
In response to Re: %x, %g warnings  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: nitpick consistency patch for pg_dump.c  ("Andrew Dunstan" <andrew@dunslane.net>)
Re: nitpick consistency patch for pg_dump.c  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: nitpick consistency patch for pg_dump.c  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
This is a totally trivial patch for something that was a very minor nit that
annoyed me the other day while I was documenting my current project. It
makes pg_dump use the same layout for types as for tables, by putting "\n\t"
before the first field and "\n" before the final ");"

Can't really justify this too much except to say I had an itch and I
scratched it ;-)

cheers

andrew



*** pg_dump.c~  2003-06-25 00:08:19.000000000 -0400
--- pg_dump.c   2003-07-17 15:34:52.000000000 -0400
***************
*** 3412,3418 ****
        i_attname = PQfnumber(res, "attname");
        i_atttypdefn = PQfnumber(res, "atttypdefn");

!       appendPQExpBuffer(q, "CREATE TYPE %s AS (",
                                          fmtId(tinfo->typname));

        for (i = 0; i < ntups; i++)
--- 3412,3418 ----
        i_attname = PQfnumber(res, "attname");
        i_atttypdefn = PQfnumber(res, "atttypdefn");

!       appendPQExpBuffer(q, "CREATE TYPE %s AS (\n",
                                          fmtId(tinfo->typname));

        for (i = 0; i < ntups; i++)
***************
*** 3423,3433 ****
                attname = PQgetvalue(res, i, i_attname);
                atttypdefn = PQgetvalue(res, i, i_atttypdefn);

!               if (i > 0)
!                       appendPQExpBuffer(q, ",\n\t");
!               appendPQExpBuffer(q, "%s %s", fmtId(attname), atttypdefn);
        }
!       appendPQExpBuffer(q, ");\n");

        /*
         * DROP must be fully qualified in case same name appears in
--- 3423,3431 ----
                attname = PQgetvalue(res, i, i_attname);
                atttypdefn = PQgetvalue(res, i, i_atttypdefn);

!               appendPQExpBuffer(q, "\n\t%s %s", fmtId(attname),
atttypdefn);        }
!       appendPQExpBuffer(q, "\n);\n");

        /*
         * DROP must be fully qualified in case same name appears in







pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: postgresql.conf formatting cleanup
Next
From: Bruce Momjian
Date:
Subject: Re: Adding Rendezvous support to postmaster