My humble patch for pg_dump :-)
Started by Constantin Teodorescuabout 27 years ago1 messages
Hello,
I am attaching here my humble patch for pg_dump utility modified by me
for readability purposes.
The main (and single) thing that is doing is changing the layout of
pg_dump'ed table structure by writing a single field per line so viewing
and changing the structure will be easier.
If you consider it useful, let it be included !
With my best regards,
--
Constantin Teodorescu
FLEX Consulting Braila, ROMANIA
Attachments:
pg_dump.patch.1text/plain; charset=us-ascii; name=pg_dump.patch.1Download
*** ./bin/pg_dump/pg_dump.c.orig Sat Nov 28 12:57:58 1998
--- ./bin/pg_dump/pg_dump.c Sat Nov 28 13:15:35 1998
***************
*** 2622,2628 ****
becomeUser(fout, tblinfo[i].usename);
! sprintf(q, "CREATE TABLE %s (", fmtId(tblinfo[i].relname));
actual_atts = 0;
for (j = 0; j < tblinfo[i].numatts; j++)
{
--- 2622,2628 ----
becomeUser(fout, tblinfo[i].usename);
! sprintf(q, "CREATE TABLE %s (\n\t", fmtId(tblinfo[i].relname));
actual_atts = 0;
for (j = 0; j < tblinfo[i].numatts; j++)
{
***************
*** 2634,2640 ****
{
sprintf(q, "%s%s%s char",
q,
! (actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]));
sprintf(q, "%s(%d)",
--- 2634,2640 ----
{
sprintf(q, "%s%s%s char",
q,
! (actual_atts > 0) ? ", \n\t" : "",
fmtId(tblinfo[i].attnames[j]));
sprintf(q, "%s(%d)",
***************
*** 2646,2652 ****
{
sprintf(q, "%s%s%s %s",
q,
! (actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j]),
tblinfo[i].typnames[j]);
if(tblinfo[i].atttypmod[j] != -1) {
--- 2646,2652 ----
{
sprintf(q, "%s%s%s %s",
q,
! (actual_atts > 0) ? ", \n\t" : "",
fmtId(tblinfo[i].attnames[j]),
tblinfo[i].typnames[j]);
if(tblinfo[i].atttypmod[j] != -1) {
***************
*** 2665,2671 ****
strcpy(id2, fmtId(tblinfo[i].typnames[j]));
sprintf(q, "%s%s%s %s",
q,
! (actual_atts > 0) ? ", " : "",
id1,
id2);
actual_atts++;
--- 2665,2671 ----
strcpy(id2, fmtId(tblinfo[i].typnames[j]));
sprintf(q, "%s%s%s %s",
q,
! (actual_atts > 0) ? ", \n\t" : "",
id1,
id2);
actual_atts++;
***************
*** 2682,2688 ****
{
sprintf(q, "%s%s %s",
q,
! (actual_atts + k > 0) ? ", " : "",
tblinfo[i].check_expr[k]);
}
--- 2682,2688 ----
{
sprintf(q, "%s%s %s",
q,
! (actual_atts + k > 0) ? ", \n\t" : "",
tblinfo[i].check_expr[k]);
}