FK type mismatches?

From: Neil Conway <neilc(at)samurai(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: FK type mismatches?
Date: 2003-09-04 15:57:04
Message-ID: 1062691024.2233.10.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Should this produce a warning?

nconway=# create table a (b int4 unique);
NOTICE: CREATE TABLE / UNIQUE will create implicit index "a_b_key" for
table "a"
CREATE TABLE
nconway=# create table c (d int8 references a (b));
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
CREATE TABLE

Aside from the logical inconsistency, it will also lead to poor
performance since the type mismatch will prevent index scans. I've
noticed a couple people have reported performance issues due to making
this kind of mistake.

-Neil

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2003-09-04 15:57:26 Re: Seqscan in MAX(index_column)
Previous Message Jenny - 2003-09-04 15:56:31 tablelevel and rowlevel locks