Problem creating UNIQUE constraint

Started by Oliver Elphickover 25 years ago1 messages
#1Oliver Elphick
olly@lfix.co.uk

Version: 7.0.2

There seems to be a problem with creating a unique constraint, like this:

bray=# CREATE TABLE supplier ( terms CHAR(2) ,ac_code CHAR(5)
UNIQUE) INHERITS (organisation);
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'supplier_ac_code_key'
for table 'supplier'
ERROR: RelationClearRelation: relation 2951924 modified while in use

but without UNIQUE:

bray=# create table supplier (terms char(2), acs_code char(5)) inherits
(organisation);
CREATE

bray=# \d organisation
Table "organisation"
Attribute | Type | Modifier
------------+----------+--------------------
ptype | smallint |
id | char(10) | not null
name | text | not null
address | integer |
salutation | text | default 'Dear Sir'
envelope | text |
email | text |
www | text |
contact | char(10) |
structure | char(1) |
department | text |
parent_id | char(10) |
Constraints: (((department ISNULL) AND (parent_id ISNULL)) OR ((department >
''::text) AND (parent_id > ''::bpchar)))
((((structure = 'L'::bpchar) OR (structure = 'C'::bpchar)) OR
(structure = 'U'::bpchar)) OR (structure = 'O'::bpchar))
Rules: organisation_type_ins_rule,
organisation_type_upd_rule
Triggers: RI_ConstraintTrigger_2950794,
RI_ConstraintTrigger_2950240

bray=#

--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The Spirit of the Lord is upon me, because he hath
anointed me to preach the gospel to the poor; he hath
sent me to heal the brokenhearted, to preach
deliverance to the captives, and recovering of sight
to the blind, to set at liberty them that are
bruised..." Luke 4:18