Re: [HACKERS] pg_dump vs malloc

2011-11-25 Thread Bruce Momjian
Bruce Momjian wrote: > I developed the attached patch to handle this. I moved the catalog code > from common.c into dumpcatalog.c, so there are just memory routines now > in common.c. I created new memory routines in pg_dumpall.c because > there is no AH structure in pg_dumpall.c. I then modifie

Re: [HACKERS] pg_dump vs malloc

2011-10-15 Thread Magnus Hagander
On Fri, Oct 14, 2011 at 21:11, Bruce Momjian wrote: > Magnus Hagander wrote: >> On Wed, Jun 22, 2011 at 17:48, Tom Lane wrote: >> > Magnus Hagander writes: >> >> Something along the line of this? >> > >> > I think this is a seriously, seriously bad idea: >> > >> >> +#define strdup(x) pg_strdup(x

Re: [HACKERS] pg_dump vs malloc

2011-10-14 Thread Bruce Momjian
Magnus Hagander wrote: > On Wed, Jun 22, 2011 at 17:48, Tom Lane wrote: > > Magnus Hagander writes: > >> Something along the line of this? > > > > I think this is a seriously, seriously bad idea: > > > >> +#define strdup(x) pg_strdup(x) > >> +#define malloc(x) pg_malloc(x) > >> +#define calloc(x,

Re: [HACKERS] pg_dump vs malloc

2011-06-22 Thread Alvaro Herrera
Excerpts from Magnus Hagander's message of mié jun 22 11:25:43 -0400 2011: > On Fri, Jun 10, 2011 at 21:07, Tom Lane wrote: > > Magnus Hagander writes: > >> I came across a situation today with a pretty bad crash of pg_dump, > >> due to not checking the return code from malloc(). When looking > >

Re: [HACKERS] pg_dump vs malloc

2011-06-22 Thread Magnus Hagander
On Wed, Jun 22, 2011 at 17:48, Tom Lane wrote: > Magnus Hagander writes: >> Something along the line of this? > > I think this is a seriously, seriously bad idea: > >> +#define strdup(x) pg_strdup(x) >> +#define malloc(x) pg_malloc(x) >> +#define calloc(x,y) pg_calloc(x, y) >> +#define realloc(x,

Re: [HACKERS] pg_dump vs malloc

2011-06-22 Thread Peter Geoghegan
On 22 June 2011 16:25, Magnus Hagander wrote: > Something along the line of this? IMHO the redefinition of malloc() looks a bit hairy...can't you just make the callers use the functions directly? -- Peter Geoghegan       http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Trainin

Re: [HACKERS] pg_dump vs malloc

2011-06-22 Thread Tom Lane
Magnus Hagander writes: > Something along the line of this? I think this is a seriously, seriously bad idea: > +#define strdup(x) pg_strdup(x) > +#define malloc(x) pg_malloc(x) > +#define calloc(x,y) pg_calloc(x, y) > +#define realloc(x,y) pg_realloc(x, y) as it will render the code unreadable

Re: [HACKERS] pg_dump vs malloc

2011-06-22 Thread Magnus Hagander
On Fri, Jun 10, 2011 at 21:07, Tom Lane wrote: > Magnus Hagander writes: >> I came across a situation today with a pretty bad crash of pg_dump, >> due to not checking the return code from malloc(). When looking >> through the code, it seems there are a *lot* of places in pg_dump that >> doesn't c

Re: [HACKERS] pg_dump vs malloc

2011-06-10 Thread Tom Lane
Magnus Hagander writes: > I came across a situation today with a pretty bad crash of pg_dump, > due to not checking the return code from malloc(). When looking > through the code, it seems there are a *lot* of places in pg_dump that > doesn't check the malloc return code. > But we do have a pg_ma

[HACKERS] pg_dump vs malloc

2011-06-10 Thread Magnus Hagander
I came across a situation today with a pretty bad crash of pg_dump, due to not checking the return code from malloc(). When looking through the code, it seems there are a *lot* of places in pg_dump that doesn't check the malloc return code. But we do have a pg_malloc() function in there - but from