X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 21B793A6D58 for ; Fri, 10 Dec 2004 19:54:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22197-08 for ; Fri, 10 Dec 2004 19:53:37 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id 379693AA1C6 for ; Fri, 10 Dec 2004 18:32:15 +0000 (GMT) Received: from mail7.atl.registeredsite.com (mail7.atl.registeredsite.com [64.224.219.81]) by svr4.postgresql.org (Postfix) with ESMTP id 3DBFE5B4E3E for ; Fri, 10 Dec 2004 12:34:26 +0000 (GMT) Received: from pixelart.es (pixelart.es [216.122.189.118] (may be forged)) by mail7.atl.registeredsite.com (8.12.11/8.12.8) with ESMTP id iBACXnAm011141 for ; Fri, 10 Dec 2004 12:33:49 GMT Received: from mj (224.Red-80-32-232.pooles.rima-tde.net [80.32.232.224]) by pixelart.es (8.8.7/8.8.5) with ESMTP id EAA27105 for ; Fri, 10 Dec 2004 04:33:46 -0800 (PST) From: =?iso-8859-1?Q?M=AA_Jos=E9_Sempere?= To: Subject: digest as IMMUTABLE function Date: Fri, 10 Dec 2004 13:33:44 +0100 Organization: Pixelart S.L. Message-ID: <000001c4deb4$7fa9f1e0$0900a8c0@mj> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.056 tagged_above=0 required=5 tests=AWL, RCVD_IN_NJABL_PROXY X-Spam-Level: * X-Archive-Number: 200412/66 X-Sequence-Number: 15652 Hello, We were trying to create an index using the digest function like that = (where picture is a bytea field): create unique index my_index on my_table digest(picture, 'md5')); but we got the error: ERROR: functions in index expression must be marked IMMUTABLE So, we have created the function digestinmutable(), like that: CREATE OR REPLACE FUNCTION digestinmutable(bytea, text) RETURNS bytea AS '$libdir/pgcrypto', 'pg_digest' LANGUAGE 'c' IMMUTABLE; And after that, we have created the index using the new function (digestinmutable) : create unique index my_index on my_table digestinmutable(picture, = 'md5')); IT SEEMS TO WORK OK. Does Anybody know if we'll have any problem using = md5 in that way? Thank you very much for your help. Bye