Re: MAGIC_MODULE and libc - Mailing list pgsql-general

From Jeff Amiel
Subject Re: MAGIC_MODULE and libc
Date
Msg-id 4587F7E2.1010703@istreamimaging.com
Whole thread Raw
In response to Re: MAGIC_MODULE and libc  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
yup...
I did this
CREATE OR REPLACE FUNCTION getpid()
  RETURNS integer AS
$BODY$
DECLARE
   thepid integer;
BEGIN
select into thepid pg_backend_pid from pg_backend_pid();
return thepid;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;

thanks!!!


Martijn van Oosterhout wrote:
On Tue, Dec 19, 2006 at 08:20:23AM -0600, Jeff Amiel wrote: 
ERROR: incompatible library "/lib/libc.so.6": missing magic block
SQL state: XX000
Hint: Extension libraries are required to use the PG_MODULE_MAGIC macro.

I've added the appropriate macro to all my actual C code...but in this
case surely I am not expected to recompile libc...am I?  Is there an
easier way to get the pid of the current process?   
In general you should use a wrapper library, but in your case
pg_backend_pid() will do it.

Have a nice day, 

pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: Let's play bash the search engine
Next
From: Csaba Nagy
Date:
Subject: Re: Second attempt, roll your own autovacuum