Skip site navigation (1) Skip section navigation (2)

Re: constraints & tableoid [pgsql8.1]

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 (view raw or flat)
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


In response to

pgsql-bugs by date

Next:From: Michael FuhrDate: 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]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group