From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | 维 姜 <jw(dot)pgsql(at)sduept(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: constraints & tableoid [pgsql8.1] |
Date: | 2006-04-11 08:26:58 |
Message-ID: | 443B6852.7070900@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
维 姜 wrote:
> jw=# CREATE TABLE base ( CHECK (tableoid = 'base'::regclass) );
> CREATE TABLE
> jw=# \d base
> Table "public.base"
> Column | Type | Modifiers
> --------+------+-----------
> Check constraints:
> "base_tableoid_check" CHECK (tableoid = 'base'::regclass::oid)
>
> jw=# INSERT INTO base DEFAULT VALUES ;
> ERROR: new row for relation "base" violates check constraint
> "base_tableoid_check"
> jw=#
The CHECK tests the tuple that is being inserted, which doesn't include
tableoid. I'm not sure if this counts as a bug or not.
You might be able to do this with a trigger function (although I'm not
clear what you're trying to do).
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2006-04-11 08:43:50 | Re: constraints & tableoid [pgsql8.1] |
Previous Message | 维 姜 | 2006-04-11 07:11:46 | constraints & tableoid [pgsql8.1] |