Re: Code for user-defined type

From: Paul Jones <pbj(at)cmicdo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pavel(dot)stehule(at)gmail(dot)com" <pavel(dot)stehule(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Code for user-defined type
Date: 2014-05-29 18:50:08
Message-ID: 1401389408.74164.YahooMailNeo@web161704.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

----- Original Message -----
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: Paul Jones <pbj(at)cmicdo(dot)com>
> Cc: "pavel(dot)stehule(at)gmail(dot)com" <pavel(dot)stehule(at)gmail(dot)com>; "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
> Sent: Thursday, May 29, 2014 11:32 AM
> Subject: Re: [GENERAL] Code for user-defined type
>
> Paul Jones <pbj(at)cmicdo(dot)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

Ok, I am going to recompile with --enable-cassert and give
cstring_to_text/text_to_cstring another try to see if I can track down
what's going wrong.  I'm letting internal routines do all the work
so it's probably something bad I'm passing to them.

PJ

>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2014-05-29 18:51:40 Re: Backups over slave instead master?
Previous Message Andres Freund 2014-05-29 18:02:15 Re: Backups over slave instead master?