[HACKERS] Patch for pg_dump
I often need in command line to get the code of function, so I make a patch for pg_dump, thanks this patch pg_dump is able to dump only one functions or all the functions. The argument is --object or -B Example: ./pg_dump -Bfunction:test_it -Bfunction:dblink_open To dump the functions test_it, dblink_open ./pgdump --object=function or pg_dump -Bfunction to dump only the functions It is possible to add other objects, (see getObject functions) I hope you'll find it interesting. Regards, .D. (patch under BSD licence) patch-pg_dump.8.2.3.gz Description: GNU Zip compressed data ---(end of broadcast)--- TIP 6: explain analyze is your friend
[HACKERS] where to write small reusable functions ?
Hi, I'm working to implement a new feature to pg_dump: the ability to dump objects like function, indexes... And I notice that there some usefull functions like pg_malloc, pg_calloc... So I've added pg_free to avoid the sequence if-not-null-free-point-to-NULL, now I'd like to add a function pg_strcat like this char * pg_strcat (char *dest,char *src) { /* pg_realloc is a safer function than realloc */ dest=pg_realloc(dest,strlen(dest)+strlen(src)+1); strcat(dest,src); return dest; } But, in that case, those functions are only usable for pg_dump, what about the rest of code ? We don't have a central location for those small reusable snippets of code ? Regards, .D.
Re: [HACKERS] where to write small reusable functions ?
On 4/13/07, Heikki Linnakangas [EMAIL PROTECTED] wrote: Dany DeBontridder wrote: I'm working to implement a new feature to pg_dump: the ability to dump objects like function, indexes... pg_dump already dumps functions and indexes. Right but you can't dump only one or two functions or only the functions and nothing else. (the same for index, triggers...) D.
Re: [HACKERS] Patch for pg_dump
On 3/21/07, Tom Lane [EMAIL PROTECTED] wrote: Bruce Momjian [EMAIL PROTECTED] writes: I guess this matches this TODO item: o Allow selection of individual object(s) of all types, not just tables (...) Code-wise, the patch seems a bit of a mess too --- it will certainly not scale up to dumping some functions and some other things, as one would expect for instance if one said pg_dump -Q myfunc -t mytab It doesn't even look like it will handle multiple -Q switches. I think a minimum expectation is that -Q would work like -t now does. Well it was my first patch :-) So I suggest to use a generic argument like --object=function, which could be extended later to object=type, table, sequence, trigger... But now I have another problem: how to specify a name ? regards, D.
Re: [HACKERS] Patch for pg_dump
Sorry I forgot the attach :-) It is not perfect so bear with me, it is my first try. Regards, D. On 3/21/07, Bruce Momjian [EMAIL PROTECTED] wrote: And the patch is so small, it is invisible (missing). ;-) --- Dany DeBontridder wrote: Here is a (small) patch to give the ability to pg_dump to export only the functions (or only one), very useful when you often develop with psql ( postgresql.8.2.3) Usage: pg_dump -Q function_name DATABASE export function_name pg_dump -QDATABASE export all the functions This patch is distributed under the BSD licence Regards, D. PS: I hope it is the correct ml, otherwise excuse me, it is the first time I propose a patch for postgresql -- Bruce Momjian [EMAIL PROTECTED] http://momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + pg_dump-8.2.3.patch.gz Description: GNU Zip compressed data ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
[HACKERS] Patch for pg_dump
Here is a (small) patch to give the ability to pg_dump to export only the functions (or only one), very useful when you often develop with psql ( postgresql.8.2.3) Usage: pg_dump -Q function_name DATABASE export function_name pg_dump -QDATABASE export all the functions This patch is distributed under the BSD licence Regards, D. PS: I hope it is the correct ml, otherwise excuse me, it is the first time I propose a patch for postgresql