Re: REFERENCES error message complaint, suggestion

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: REFERENCES error message complaint, suggestion
Date: 2004-03-04 16:17:03
Message-ID: 20040304101703.M18208@mofo.meme.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 2004.03.04 09:13 Tom Lane wrote:
> "Karl O. Pinc" <kop(at)meme(dot)com> writes:
> > Does 7.4 do something similar with CHECK constraints?
>
> Nope, just
>
> regression=# create table baz(f1 int check (f1 > 0));
> CREATE TABLE
> regression=# insert into baz values(-1);
> ERROR: new row for relation "baz" violates check constraint "baz_f1"
> regression=#
>
> I think this is sufficient though, and that database designers ought
> to
> choose helpful names for constraints.

A note somewhere in the documentation that this is a useful practice
would
be helpful to newbies. (I'm going back and adding constraint names now,
after the fact.)

> I should have said something
> like
> ... constraint "f1 must be positive" check (f1 > 0)
> if I were concerned about the error message quality.

I tried this (in 7.3) only using single quotes instead of double quotes
and got syntax errors. Where do I look in the docs to learn
about this aspect of the syntax? (I also note that the examples
often single quote the plpgsql language keyword in CREATE FUNCTION
statements, but I haven't and although I read through the whole
manual didn't notice where such quotes are allowed and/or
required.)

>
> I didn't care much for your suggestion of showing the constraint
> expression, because to the average non-programmer it would just be
> noise.

You're right about that.

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pascal Polleunus 2004-03-04 16:18:46 Aggregate function capability with \d in psql
Previous Message Lamar Owen 2004-03-04 16:06:41 Re: Are Postgres 7.4.1 RPMs available for SuSE 9.0 ?