HELP Check constraint

From: Anand Surelia <anand(at)bytekinc(dot)com>
To: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: HELP Check constraint
Date: 1998-09-17 00:13:27
Message-ID: 36005427.D5C8ECAB@bytekinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have created a function "int fname(void)" in C. When I create this
function in Postgres as returning int4 and then do a
" create table dummy (level int4 check(fname() > 4));"
the creation fails saying that :
ERROR: There is no operator '>' for types 'bool' and 'int4'
You will either have to retype this query using an explicit
cast,
or you will have to define the operator using CREATE OPERATOR

I've tried this for different operators and it comes up with the same
error even though I know the operators exist.

However, when I create fname as returning int2 and then create the
table, it says:
NOTICE: PortalHeapMemoryFree: 0x8178389 not in alloc set!
CREATE

Which means that the table has been created.
Now when I do a insert into the table it fails saying:
PQexec() -- Request was sent to backend, but backend closed the channel
before r
esponding.
This probably means the backend terminated abnormally before or
while pr
ocessing the request.

Could someone please explain what is going on?

Do the Check constraints do not take functions?

Thanks,
Anand

Browse pgsql-general by date

  From Date Subject
Next Message Anand Surelia 1998-09-17 09:56:58 HELP Check constraint
Previous Message Lior Chen 1998-09-16 16:04:21 Postgres support for the Hebrew charset