Re: Code for user-defined type - Mailing list pgsql-general

From Tom Lane
Subject Re: Code for user-defined type
Date
Msg-id 12893.1401381153@sss.pgh.pa.us
Whole thread Raw
In response to Re: Code for user-defined type  (Paul Jones <pbj@cmicdo.com>)
Responses Re: Code for user-defined type  (Paul Jones <pbj@cmicdo.com>)
List pgsql-general
Paul Jones <pbj@cmicdo.com> writes:
> I used the proper XGetDatum and DatumGetX and was able to get it to work
> properly.� However, I since discovered that I probably should not use
> "cstring_to_text" because of the palloc's it does.� The problem comes
> when doing "\copy table from file".� After about 1000 rows, the backend
> dies with SEGV, I think because of too many pallocs being created in
> the copy transaction.

That probably means you're stomping on memory that doesn't belong to you.

pallocs per se should not be a problem for COPY --- it does a context
reset per row.  And even if it didn't, you'd not likely be running out
of memory after a mere thousand rows.  However, a buffer-overrun type
of coding error would be probabilistic as to when it became obvious
via a core dump; some of the time you'd be stomping on memory that
was unused anyway.

            regards, tom lane


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgresql 9.2.4 - timezone error
Next
From: Jerry Sievers
Date:
Subject: Re: Postgresql 9.2.4 - timezone error