From: Forest Wilkinson <fspam@home.com>
To: pgsql-sql@postgresql.org
Subject: non-cachable 'C' language functions
Date: Fri, 11 Aug 2000 18:18:13 -0700
Message-ID: <kj89psotsjohu3nqb2nb2iotigd5d844d2@4ax.com> (raw)
(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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: fspam@home.com
Subject: Re: non-cachable 'C' language functions
In-Reply-To: <kj89psotsjohu3nqb2nb2iotigd5d844d2@4ax.com>
References: <kj89psotsjohu3nqb2nb2iotigd5d844d2@4ax.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox