Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 62F9F476786 for ; Wed, 9 Oct 2002 09:41:44 -0400 (EDT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 17A524765E8 for ; Wed, 9 Oct 2002 09:40:43 -0400 (EDT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id g99Deep09786 for ; Wed, 9 Oct 2002 19:10:40 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id g99Dedv09776; Wed, 9 Oct 2002 19:10:39 +0530 From: "Shridhar Daithankar" To: pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Date: Wed, 09 Oct 2002 19:11:09 +0530 MIME-Version: 1.0 Subject: Re: [pgsql-performance] Large databases, performance Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DA47F4D.12909.1AAA876E@localhost> References: In-reply-to: <19697.1034170370@sss.pgh.pa.us> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/496 X-Sequence-Number: 31494 On 9 Oct 2002 at 9:32, Tom Lane wrote: > Manfred Koizar writes: > > here is an implementation of a set of user types: char3, char4, > > char10. > > Coupla quick comments on these: > > > CREATE FUNCTION charNN_lt(charNN, charNN) > > RETURNS boolean > > AS '$libdir/fixchar' > > LANGUAGE 'c'; > > > bool > > charNN_lt(char *a, char *b) > > { > > return (strncmp(a, b, NN) < 0); > > }/*charNN_lt*/ > > These functions are dangerous as written, because they will crash on > null inputs. I'd suggest marking them strict in the function > declarations. Some attention to volatility declarations (isCachable > or isImmutable) would be a good idea too. Let me add something. Using char* is bad idea. I had faced a situation recently on HP-UX 11 that with a libc patch, isspace collapsed for char>127. Fix was to use unsigned char. There are other places also where the input character is used as index to an array internally and can cause weird behaviour for values >127 I will apply both the correction here. Will post the final stuff soon. Bye Shridhar -- Hacker's Quicky #313: Sour Cream -n- Onion Potato Chips Microwave Egg Roll Chocolate Milk