Re: constraints & tableoid [pgsql8.1] - Mailing list pgsql-bugs

From Richard Huxton
Subject Re: constraints & tableoid [pgsql8.1]
Date
Msg-id 443B6852.7070900@archonet.com
Whole thread Raw
In response to constraints & tableoid [pgsql8.1]  (维 姜 <jw.pgsql@sduept.com>)
List pgsql-bugs
=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

pgsql-bugs by date:

Previous
From: 维 姜
Date:
Subject: constraints & tableoid [pgsql8.1]
Next
From: Michael Fuhr
Date:
Subject: Re: constraints & tableoid [pgsql8.1]