How to create a new PL language in postgres - Mailing list pgsql-general

From jesselee@sohu.com
Subject How to create a new PL language in postgres
Date
Msg-id 8eef01bf4869$a6e25540$39b96aca@sohu.com
Whole thread Raw
List pgsql-general
Dear Sir,

I want to use plpgsql as a program language in my postgres, and install it reference to the document in postgres.

I do the following:

1. Login postgres database
2. Enter the script:
create function plpgsql_call_handler() returns OPAQUE as
 '  /usr/lib/plpgsql.so' language 'C';

create trusted procedural language 'plpgsql'
     handler plpgsql_call_handler
     lancompiler 'PL/pgsql';

3.create a function like this:
create function test3(int4) returns int4 as
'  begin
        insert into customer values($1, 'China','Jesse');
        return 1;
   end;
' language 'plpgsql;

and all the operation above return create and I use the following command to test the funciton:
               select test3(1) as answer

but the system returns the error:

                ERROR:  fmgr_info: Cache lookup for language %d failed 21153

Can you tell me what have happen and how can I use plpgsql in postgres?

My Mailaddress: JesseLee@soho.com

Thanks & Regards,
Jesse



pgsql-general by date:

Previous
From: Ed Loehr
Date:
Subject: [GENERAL] How to get timestamped pgsql logging?
Next
From: "Justin Hickey"
Date:
Subject: Confirmation of feature of in version 7