partitioned lookup table? - Mailing list pgsql-general

From Andreas Kretschmer
Subject partitioned lookup table?
Date
Msg-id 20100416144818.GA21126@tux
Whole thread Raw
Responses Re: partitioned lookup table?
Re: partitioned lookup table?
List pgsql-general
Hi @all,

A question, found in the german PG-Forum:

is it possible to partitionate a lookup-table? What i mean is:

test=# create table foo(i int primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
CREATE TABLE
test=*# create table bla ( i int references foo);
CREATE TABLE
test=*# insert into foo values (1);
INSERT 0 1
test=*# insert into bla values (1);
INSERT 0 1
test=*# create table foo_2 () inherits (foo);
CREATE TABLE
test=*# alter table foo_2 add primary key (i);
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "foo_2_pkey" for table "foo_2"
ALTER TABLE


Well, now i'd like to move data from foo into foo_2:

test=*# insert into foo_2 select * from foo;
INSERT 0 1
test=*# delete from foo;
ERROR:  update or delete on table "foo" violates foreign key constraint "bla_i_fkey" on table "bla"
DETAIL:  Key (i)=(1) is still referenced from table "bla".

Can i do that in an other way, or is it impossible? I think, it's
impossible, right?



Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: readline library not found
Next
From: Vick Khera
Date:
Subject: Re: partitioned lookup table?