Re: Is record handle available to a check constraint stored procedure call?

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Is record handle available to a check constraint stored procedure call?
Дата
Msg-id jkmn5i$g5g$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Is record handle available to a check constraint stored procedure call?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Список pgsql-general
On 2012-03-23, Gauthier, Dave <dave.gauthier@intel.com> wrote:
> --_000_0AD01C53605506449BA127FB8B99E5E10C358B82FMSMSX105amrcor_
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
>
> v8.3.4 on Linux
>
> I have a check constraint on a column.  The constraint decides pass/fail ba=
> sed on the returned status of a stored procedure call that returns either "=
> OK" or "NO".  So when the stored procedure is called, there's a living atte=
> mpt to insert or update a record.
>
> Question:  Is there a handle on the record being inserted or updated?  Some=
> thing like what's available in a trigger function (new.col1, old.col2, etc.=
> ..)?  If so, what does it look like?

it looks like the name of the table

create function somefunc( a foo ) returns boolean as
$$ begin return a.id <> 7 ; end $$ language plpgsql;

alter table foo add check ( somefunc(foo));

--
⚂⚃ 100% natural

В списке pgsql-general по дате отправления:

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: can these queries be combined into one?
Следующее
От: François Beausoleil
Дата:
Сообщение: Re: Streaming replication and empty databases