Received: from mail.rdc1.sdca.home.com (imail@ha1.rdc1.sdca.home.com [24.0.3.66]) by hub.org (8.10.1/8.10.1) with ESMTP id e7C1FZG26559 for ; Fri, 11 Aug 2000 21:15:36 -0400 (EDT) Received: from tajar ([24.1.6.224]) by mail.rdc1.sdca.home.com (InterMail vM.4.01.03.00 201-229-121) with SMTP id <20000812011527.BUW15602.mail.rdc1.sdca.home.com@tajar> for ; Fri, 11 Aug 2000 18:15:27 -0700 From: Forest Wilkinson To: pgsql-sql@postgresql.org Subject: non-cachable 'C' language functions Date: Fri, 11 Aug 2000 18:18:13 -0700 Message-ID: X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200008/79 (using postgresql 6.5.2) I have created a set of postgres extension functions in C (which use SPI to perform queries), and added them to my database with something like this: CREATE FUNCTION my_next_uid(text) RETURNS text AS '/usr/lib/pgsql/my_uids.so' LANGUAGE 'c'; My functions are designed to behave like nextval() and friends, except that they operate on a varchar field in a predetermined table, rather than a database sequence. For example, my_next_uid() should always return a unique value, incrementing the current value in said table each time it is called. So far, my functions appear to work correctly. However, looking at their entries in the pg_proc table, I see that their "proiscachable" fields are set to true. This worries me, because my understanding is that postgres will re-use values returned by cachable functions, which is undesirable. (In order for my_next_uid() to be useful, it must retrieve a new value each time it is used.) Is my understanding correct? What should I do about it? The postgresql 6.5.2 docs for CREATE FUNCTION don't tell me how to make my functions non-cachable. Regards, Forest Wilkinson