From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | Tom Allison <tom(at)tacocat(dot)net> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: inheritance. more. |
Date: | 2008-04-28 14:31:40 |
Message-ID: | F4E64EBC-15AC-4385-86DF-00E95EE09391@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Apr 27, 2008, at 8:23 PM, Tom Allison wrote:
> create table master (
> id serial,
> mdn varchar(11),
> meid varchar(18),
> min varchar(11),
> constraint mmm_master unique (mdn, meid, min)
> );
> insert into master(mdn, meid, min)
> select mdn, meid, min from test_data where meid !=
> '000000000000000000' limit 10;
>
> Everything works up to this point...
>
> insert into master(mdn, meid, min)
> select mdn, meid, min from test_data where meid !=
> '000000000000000000' limit 10;
>
> And this fails, like I would expect it to.
>
>
> create table slave (
> deleted boolean default false
> ) inherits (master);
>
> insert into slave(mdn, meid, min)
> select mdn, meid, min from test_data where meid !=
> '000000000000000000' limit 10;
> insert into slave(mdn, meid, min)
> select mdn, meid, min from test_data where meid !=
> '000000000000000000' limit 10;
>
> I now have 30 rows in the master table, with duplicates...
No, you don't. You have duplicates in slave, not master, and there is
not unique constraint on slave. They are physically separate tables
and Postgres doesn't yet handle inheritance of constraints from parent
to child tables via inheritance.
Erik Jones
DBA | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)
Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Browne | 2008-04-28 14:36:43 | Re: How to modify ENUM datatypes? |
Previous Message | Andrew Sullivan | 2008-04-28 14:28:40 | Re: How to modify ENUM datatypes? |