Re: notice about costly ri checks (2)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Michael Glaesemann <grzm(at)myrealbox(dot)com>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: notice about costly ri checks (2)
Date: 2004-03-05 16:36:10
Message-ID: 200403051636.i25GaAp16627@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > The reason I think we have to mention the constraint name is that you
> > could have a multi-column primary/foreign key, so instead of mentioning
> > each column, we just mention the constraint name, which should be easy
> > to identify.
>
> However, the complaint will be about one single column being of a
> non-matching type. In the case of a multicolumn foreign key, giving
> only the constraint name is unhelpful. Even for a one-column key,
> it's not obvious to me why the constraint name is better than the column
> name.
>
> [ thinks... ] I guess it could be that the same column is being used in
> several different FK constraints, so if we just give column names then
> it would also be important to mention the referenced column.
>
> I'd suggest something along the lines of
>
> NOTICE: foreign key constraint "constrname" will require a cross-type conversion
> DETAIL: key columns "fkcol" and "pkcol" are of different types integer and double precision

I suggested the constraint name because of multi-column keys, where he
would have to print an arbitrary number of columns in the message. It
didn't seem worth doing that work. I see your idea of just printing the
column, but that doesn't really point to the primary/foreign key
relationship. If the user can't figure out which columns are a mismatch
from the constraint name, they have larger problems than this. :-)

> if you want to be really complete.
>
> I've got mixed feelings about the WARNING-vs-NOTICE issue. WARNING
> seems too strong, like we are trying to tell them that it won't work at
> all. Particularly with text like the above, which completely fails to
> explain that the problem is only one of speed and not functionality.
> If you want it to be a WARNING then we gotta work on the text some more.

Yes, let's re-add 'costly' to the text:

> WARNING: foreign key constraint "constrname" will require a costly cross-type conversion

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-03-05 16:42:50 Re: notice about costly ri checks (2)
Previous Message Tom Lane 2004-03-05 16:27:51 Re: notice about costly ri checks (2)