Re: [pgsql-patches] Allow dumping of roles or tablespaces
Patch applied. Thanks. --- Dave Page wrote: Tom Lane wrote: Dave Page [EMAIL PROTECTED] writes: pg_dumpall -g -- Dump roles and tablespaces per current behaviour pg_dumpall -gr -- Dump roles only (or users and groups) pg_dumpall -gt -- Dump tablespaces only This seems a bit ugly, mainly because (1) it doesn't have a natural translation to long-form switches, and (2) it screws up the usual habit of merging multiple single-letter switches into one argument. Perhaps something like --roles-only --tablespaces-only --globals-only Not sure if there are free single-letter codes for the first two, but on the whole I'm more interested in having sane long-form names than sane short ones ... Revised patch attached - it now has -r --roles-only -t --tablespaces-only -g --globals-only Regards, Dave. Index: doc/src/sgml/ref/pg_dumpall.sgml === RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v retrieving revision 1.58 diff -c -r1.58 pg_dumpall.sgml *** doc/src/sgml/ref/pg_dumpall.sgml 7 Oct 2006 20:59:04 - 1.58 --- doc/src/sgml/ref/pg_dumpall.sgml 15 Jan 2007 09:10:31 - *** *** 134,140 termoption--globals-only/option/term listitem para ! Dump only global objects (users and groups), no databases. /para /listitem /varlistentry --- 134,140 termoption--globals-only/option/term listitem para ! Dump only global objects (roles and tablespaces), no databases. /para /listitem /varlistentry *** *** 194,199 --- 194,209 /varlistentry varlistentry + termoption-r/option/term + termoption--roles-only/option/term + listitem +para + Dump only roles, no databases or tablespaces. +/para + /listitem + /varlistentry + + varlistentry termoption-s/option/term termoption--schema-only/option/term listitem *** *** 217,222 --- 227,242 /varlistentry varlistentry + termoption-t/option/term + termoption--tablespaces-only/option/term + listitem +para + Dump only tablespaces, no databases or roles. +/para + /listitem + /varlistentry + + varlistentry termoption-v//term termoption--verbose//term listitem Index: src/bin/pg_dump/pg_dumpall.c === RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v retrieving revision 1.86 diff -c -r1.86 pg_dumpall.c *** src/bin/pg_dump/pg_dumpall.c 5 Jan 2007 22:19:48 - 1.86 --- src/bin/pg_dump/pg_dumpall.c 15 Jan 2007 09:10:33 - *** *** 78,83 --- 78,85 boolforce_password = false; booldata_only = false; boolglobals_only = false; + boolroles_only = false; + booltablespaces_only = false; boolschema_only = false; PGconn *conn; int encoding; *** *** 97,107 {oids, no_argument, NULL, 'o'}, {no-owner, no_argument, NULL, 'O'}, {port, required_argument, NULL, 'p'}, ! {password, no_argument, NULL, 'W'}, {schema-only, no_argument, NULL, 's'}, {superuser, required_argument, NULL, 'S'}, {username, required_argument, NULL, 'U'}, {verbose, no_argument, NULL, 'v'}, {no-privileges, no_argument, NULL, 'x'}, {no-acl, no_argument, NULL, 'x'}, --- 99,111 {oids, no_argument, NULL, 'o'}, {no-owner, no_argument, NULL, 'O'}, {port, required_argument, NULL, 'p'}, ! {roles-only, no_argument, NULL, 'r'}, {schema-only, no_argument, NULL, 's'}, {superuser, required_argument, NULL, 'S'}, + {tablespaces-only, no_argument, NULL, 't'}, {username, required_argument, NULL, 'U'}, {verbose, no_argument, NULL, 'v'}, + {password, no_argument, NULL, 'W'}, {no-privileges, no_argument, NULL, 'x'}, {no-acl, no_argument, NULL, 'x'}, *** *** 161,167 pgdumpopts = createPQExpBuffer(); ! while ((c = getopt_long(argc, argv, acdDgh:ioOp:sS:U:vWxX:, long_options, optindex)) != -1) { switch (c) { --- 165,171 pgdumpopts = createPQExpBuffer(); ! while ((c = getopt_long(argc, argv,
Re: [pgsql-patches] Allow dumping of roles or tablespaces
Tom Lane wrote: Dave Page [EMAIL PROTECTED] writes: pg_dumpall -g -- Dump roles and tablespaces per current behaviour pg_dumpall -gr -- Dump roles only (or users and groups) pg_dumpall -gt -- Dump tablespaces only This seems a bit ugly, mainly because (1) it doesn't have a natural translation to long-form switches, and (2) it screws up the usual habit of merging multiple single-letter switches into one argument. Perhaps something like --roles-only --tablespaces-only --globals-only Not sure if there are free single-letter codes for the first two, but on the whole I'm more interested in having sane long-form names than sane short ones ... Revised patch attached - it now has -r --roles-only -t --tablespaces-only -g --globals-only Regards, Dave. Index: doc/src/sgml/ref/pg_dumpall.sgml === RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v retrieving revision 1.58 diff -c -r1.58 pg_dumpall.sgml *** doc/src/sgml/ref/pg_dumpall.sgml7 Oct 2006 20:59:04 - 1.58 --- doc/src/sgml/ref/pg_dumpall.sgml15 Jan 2007 09:10:31 - *** *** 134,140 termoption--globals-only/option/term listitem para ! Dump only global objects (users and groups), no databases. /para /listitem /varlistentry --- 134,140 termoption--globals-only/option/term listitem para ! Dump only global objects (roles and tablespaces), no databases. /para /listitem /varlistentry *** *** 194,199 --- 194,209 /varlistentry varlistentry + termoption-r/option/term + termoption--roles-only/option/term + listitem +para + Dump only roles, no databases or tablespaces. +/para + /listitem + /varlistentry + + varlistentry termoption-s/option/term termoption--schema-only/option/term listitem *** *** 217,222 --- 227,242 /varlistentry varlistentry + termoption-t/option/term + termoption--tablespaces-only/option/term + listitem +para + Dump only tablespaces, no databases or roles. +/para + /listitem + /varlistentry + + varlistentry termoption-v//term termoption--verbose//term listitem Index: src/bin/pg_dump/pg_dumpall.c === RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v retrieving revision 1.86 diff -c -r1.86 pg_dumpall.c *** src/bin/pg_dump/pg_dumpall.c5 Jan 2007 22:19:48 - 1.86 --- src/bin/pg_dump/pg_dumpall.c15 Jan 2007 09:10:33 - *** *** 78,83 --- 78,85 boolforce_password = false; booldata_only = false; boolglobals_only = false; + boolroles_only = false; + booltablespaces_only = false; boolschema_only = false; PGconn *conn; int encoding; *** *** 97,107 {oids, no_argument, NULL, 'o'}, {no-owner, no_argument, NULL, 'O'}, {port, required_argument, NULL, 'p'}, ! {password, no_argument, NULL, 'W'}, {schema-only, no_argument, NULL, 's'}, {superuser, required_argument, NULL, 'S'}, {username, required_argument, NULL, 'U'}, {verbose, no_argument, NULL, 'v'}, {no-privileges, no_argument, NULL, 'x'}, {no-acl, no_argument, NULL, 'x'}, --- 99,111 {oids, no_argument, NULL, 'o'}, {no-owner, no_argument, NULL, 'O'}, {port, required_argument, NULL, 'p'}, ! {roles-only, no_argument, NULL, 'r'}, {schema-only, no_argument, NULL, 's'}, {superuser, required_argument, NULL, 'S'}, + {tablespaces-only, no_argument, NULL, 't'}, {username, required_argument, NULL, 'U'}, {verbose, no_argument, NULL, 'v'}, + {password, no_argument, NULL, 'W'}, {no-privileges, no_argument, NULL, 'x'}, {no-acl, no_argument, NULL, 'x'}, *** *** 161,167 pgdumpopts = createPQExpBuffer(); ! while ((c = getopt_long(argc, argv, acdDgh:ioOp:sS:U:vWxX:, long_options, optindex)) != -1) { switch (c) { --- 165,171 pgdumpopts = createPQExpBuffer(); ! while ((c = getopt_long(argc, argv, acdDgh:ioOp:rsS:tU:vWxX:, long_options, optindex)) != -1) { switch (c) { *** *** 214,219 --- 218,227
Re: [pgsql-patches] Allow dumping of roles or tablespaces
Dave Page [EMAIL PROTECTED] writes: pg_dumpall -g -- Dump roles and tablespaces per current behaviour pg_dumpall -gr -- Dump roles only (or users and groups) pg_dumpall -gt -- Dump tablespaces only This seems a bit ugly, mainly because (1) it doesn't have a natural translation to long-form switches, and (2) it screws up the usual habit of merging multiple single-letter switches into one argument. Perhaps something like --roles-only --tablespaces-only --globals-only Not sure if there are free single-letter codes for the first two, but on the whole I'm more interested in having sane long-form names than sane short ones ... regards, tom lane ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] Allow dumping of roles or tablespaces
Tom Lane wrote: Dave Page [EMAIL PROTECTED] writes: pg_dumpall -g -- Dump roles and tablespaces per current behaviour pg_dumpall -gr -- Dump roles only (or users and groups) pg_dumpall -gt -- Dump tablespaces only This seems a bit ugly, mainly because (1) it doesn't have a natural translation to long-form switches, and (2) it screws up the usual habit of merging multiple single-letter switches into one argument. Perhaps something like --roles-only --tablespaces-only --globals-only Not sure if there are free single-letter codes for the first two, but on the whole I'm more interested in having sane long-form names than sane short ones ... I agree. In fact, as I understand the patch it would also allow -g r and -g t, and that seems ugly too. We don't have to have a short form for every long option - e.g. initdb has several like --no-locale for which there is no corresponding short form. I suggest we make the new options long form only, along the lines Tom suggests. cheers andrew ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [pgsql-patches] Allow dumping of roles or tablespaces
Andrew Dunstan wrote: Tom Lane wrote: Dave Page [EMAIL PROTECTED] writes: pg_dumpall -g -- Dump roles and tablespaces per current behaviour pg_dumpall -gr -- Dump roles only (or users and groups) pg_dumpall -gt -- Dump tablespaces only This seems a bit ugly, mainly because (1) it doesn't have a natural translation to long-form switches, and (2) it screws up the usual habit of merging multiple single-letter switches into one argument. Perhaps something like --roles-only --tablespaces-only --globals-only Not sure if there are free single-letter codes for the first two, but on the whole I'm more interested in having sane long-form names than sane short ones ... I agree. In fact, as I understand the patch it would also allow -g r and -g t, and that seems ugly too. We don't have to have a short form for every long option - e.g. initdb has several like --no-locale for which there is no corresponding short form. I suggest we make the new options long form only, along the lines Tom suggests. OK, no probs. I'll fix it up as Tom suggests. Regards, Dave. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [pgsql-patches] Allow dumping of roles or tablespaces
Am Freitag, 12. Januar 2007 15:08 schrieb Dave Page: pg_dumpall -g -- Dump roles and tablespaces per current behaviour pg_dumpall -gr -- Dump roles only (or users and groups) pg_dumpall -gt -- Dump tablespaces only Also note that optional argument specifications in getopt like g:: are not portable, so this cannot be implemented in the first place. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings