维 姜 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
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).
In response to
pgsql-bugs by date
|Next:||From: Michael Fuhr||Date: 2006-04-11 08:43:50|
|Subject: Re: constraints & tableoid [pgsql8.1]|
|Previous:||From: 维 姜||Date: 2006-04-11 07:11:46|
|Subject: constraints & tableoid [pgsql8.1]|