Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 404464760DF; Wed, 9 Oct 2002 09:33:04 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 42696476082; Wed, 9 Oct 2002 09:32:59 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g99DWphR019698; Wed, 9 Oct 2002 09:32:51 -0400 (EDT) To: Manfred Koizar Cc: shridhar_daithankar@persistent.co.in, pgsql-hackers@postgresql.org, pgsql-general , pgsql-performance@postgresql.org Subject: Re: [pgsql-performance] Large databases, performance In-reply-to: References: <3D9C3E05.7070906@clearmetrix.com> <3DA1A331.21316.F7E742B@localhost> Comments: In-reply-to Manfred Koizar message dated "Wed, 09 Oct 2002 10:00:03 +0200" Date: Wed, 09 Oct 2002 09:32:50 -0400 Message-ID: <19697.1034170370@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/494 X-Sequence-Number: 31492 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. Also, it'd be faster and more portable to write the functions with version-1 calling conventions. Using the Makefile to auto-create the differently sized versions is a slick trick... regards, tom lane