diff -cpr postgresql-8.1.5-orig/src/backend/catalog/heap.c postgresql-8.1.5/src/backend/catalog/heap.c *** postgresql-8.1.5-orig/src/backend/catalog/heap.c 2006-04-24 10:40:39.000000000 +0900 --- postgresql-8.1.5/src/backend/catalog/heap.c 2006-10-23 16:50:22.000000000 +0900 *************** AddRelationRawConstraints(Relation rel, *** 1525,1530 **** --- 1525,1535 ---- continue; Assert(cdef->cooked_expr == NULL); + if (numchecks == 0x7FFF) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("cannot have more than 2^15-1 checks in a table"))); + /* * Transform raw parsetree to executable expression. */