Uh, I can't apply this to 7.4 unless you can get others to agree it should be added. Sorry.
OK, for reviewers. Note the index predicate and the check constraint in particular.
With patch:
test=# \d example Table "public.example" Column | Type | Modifiers --------+---------+-------------------------------------------------------- a | integer | not null default nextval('public.example_a_seq'::text) b | integer | c | integer | d | boolean | Indexes: "example_pkey" PRIMARY KEY, btree (a) "example_b_key" UNIQUE, btree (b) "example_idx" btree (abs(a)) WHERE c > 11 Check constraints: "example_d" CHECK (d) Foreign-key constraints: "$1" FOREIGN KEY (c) REFERENCES parent(a) Rules: example_rule AS ON INSERT TO example DO INSTEAD NOTHING
Without patch:
test=# \d example Table "public.example" Column | Type | Modifiers --------+---------+-------------------------------------------------------- a | integer | not null default nextval('public.example_a_seq'::text) b | integer | c | integer | d | boolean | Indexes: "example_pkey" primary key, btree (a) "example_b_key" unique, btree (b) "example_idx" btree (abs(a)) WHERE (c > 11) Check constraints: "example_d" CHECK d Foreign-key constraints: "$1" FOREIGN KEY (c) REFERENCES parent(a) Rules: example_rule AS ON INSERT TO example DO INSTEAD NOTHING
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org