=E7=BB=B4 =E5=A7=9C wrote:
> jw=3D# CREATE TABLE base ( CHECK (tableoid =3D 'base'::regclass) );
> CREATE TABLE
> jw=3D# \d base
> Table "public.base"
> Column | Type | Modifiers
> --------+------+-----------
> Check constraints:
> "base_tableoid_check" CHECK (tableoid =3D 'base'::regclass::oid)
>=20
> jw=3D# INSERT INTO base DEFAULT VALUES ;
> ERROR: new row for relation "base" violates check constraint
> "base_tableoid_check"
> jw=3D#
The CHECK tests the tuple that is being inserted, which doesn't include=20
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=20
clear what you're trying to do).
--=20
Richard Huxton
Archonet Ltd