Received: from mail.enterprise.net (mail.enterprise.net [194.72.192.18]) by hub.org (8.10.1/8.10.1) with ESMTP id e9BDe9r20941 for ; Wed, 11 Oct 2000 09:40:09 -0400 (EDT) Received: from linda.lfix.co.uk (cmax04-163.enterprise.net [212.161.114.163]) by mail.enterprise.net (8.8.5/8.8.5) with ESMTP id OAA10743 for ; Wed, 11 Oct 2000 14:40:04 +0100 (GMT/BST) Received: from lfix.co.uk (olly@localhost [127.0.0.1]) by linda.lfix.co.uk (8.11.1/8.11.1/Debian 8.11.0-6) with ESMTP id e9BDg5Y26824 for ; Wed, 11 Oct 2000 14:42:05 +0100 Message-Id: <200010111342.e9BDg5Y26824@linda.lfix.co.uk> X-Authentication-Warning: linda.lfix.co.uk: Host olly@localhost [127.0.0.1] claimed to be lfix.co.uk X-Mailer: exmh version 2.2 06/23/2000 (debian 2.2-1) with nmh-1.0.4+dev X-URL: http://www.lfix.co.uk/oliver X-face: "xUFVDj+ZJtL_IbURmI}!~xAyPC"Mrk=MkAm&tPQnNq(FWxv49R}\>0oI8VM?O2VY+N7@F- KMLl*!h}B)u@TW|B}6 X-Archive-Number: 200010/103 X-Sequence-Number: 1765 I want to do this: CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS BOOLEAN AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'C'; CREATE TABLE product ( id CHAR(10) PRIMARY KEY, brand CHAR(12) REFERENCES brandname(id) ON UPDATE CASCADE ON DELETE NO ACTION, eancode CHAR(6) CHECK (eancode IS NULL OR eancode ~ '[0-9]{6}'), ..., CONSTRAINT ean CHECK ( CASE WHEN eancode IS NULL OR brand IS NULL THEN 't' ELSE ean_checkdigit( (SELECT ean_prefix FROM brandname, product WHERE brandname.id = product.brand ), eancode) END ) ); The parser accepts it, but when it is run on a line that matches the ELSE in the constraint, I get: copy product from '/usr1/avoca/dumps/dbdump.product' ERROR: copy: line 2, ExecEvalExpr: unknown expression type 108 Can this be made to work at all (in 7.0.2)? -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47 GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "I waited patiently for the LORD; and he inclined unto me, and heard my cry. He brought me up also out of an horrible pit, out of the miry clay, and set my feet upon a rock, and established my goings." Psalms 40:1,2