Re: Partitioning option for COPY

Emmanuel Cecchet <manu@frogthinker.org>

From: Emmanuel Cecchet <manu@frogthinker.org>
To: Jan Urbański <wulczer@wulczer.org>
Cc: Emmanuel Cecchet <manu@asterdata.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2009-11-19T21:25:04Z
Lists: pgsql-hackers

Attachments

Hi Jan,

Here is a new version of the patch with the following modifications:
- used oid list from pg_list.h
- properly handles triggers and generate an error if needed (updated doc 
as well)
- added your test cases + extra bad trigger cases

Emmanuel

> Hi,
>
> I'll hopefully look at the next version of the patch tommorrow.
>
> Emmanuel Cecchet wrote:
>   
>>>  o test1.sql always segfaults for me, poking around with gdb suggests
>>> it's a case of an uninitialised cache list (another reason to use the
>>> builtin one).
>>>   
>>>       
>> I was never able to reproduce that problem. I don't know where this
>> comes from.
>>     
>
>   
>> I have integrated your tests in the regression test suite and I was
>> never able to reproduce the segfault you mentioned. What platform are
>> you using?
>>     
>
> In the meantime I tried the test1.sql file again and it still segfaulted
> for me.
> I'm using 32bit Linux, PG compiled with:
>
> $ ./configure CFLAGS=-O0 --enable-cassert --enable-debug --without-perl
> --without-python --without-openssl --without-tcl
>
> and then I start postmaster, fire up psql, attach gdb to the backend, do
> \i test1.sql and get:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0819368b in route_tuple_to_child (parent_relation=0xb5d93040,
> tuple=0x873b08c, hi_options=0, parentResultRelInfo=0x871e204) at copy.c:1821
> 1821                            child_relation_id =
> child_oid_cell->oid_value;
> (gdb) bt
> #0  0x0819368b in route_tuple_to_child (parent_relation=0xb5d93040,
> tuple=0x873b08c, hi_options=0, parentResultRelInfo=0x871e204) at copy.c:1821
> #1  0x081950e3 in CopyFrom (cstate=0x871e0dc) at copy.c:2480
> #2  0x08192532 in DoCopy (stmt=0x86fb144, queryString=0x86fa73c "copy
> parent from stdin with (partitioning);") at copy.c:1227
>
> (gdb) p child_oid_cell
> $1 = (OidCell *) 0x7f7f7f7f
>
> (gdb) p child_oid_cell->oid_value
> Cannot access memory at address 0x7f7f7f7f
>
>
> That 0x7f7f7f7f looks like clobbered memory, the memory management funcs
> do that when cassert is enabled, IIRC.
>
> Cheers,
> Jan
>
>   


-- 
Emmanuel Cecchet
FTO @ Frog Thinker 
Open Source Development & Consulting
--
Web: http://www.frogthinker.org
email: manu@frogthinker.org
Skype: emmanuel_cecchet