Thread: plpgsql and createlang?

plpgsql and createlang?

From
April L
Date:
Wow, thank you! I'll study your examples to learn as well!

I am using your fine program as a matter of fact, and when executing the
CREATE FUNCTION code below, I get the message:

ERROR: Unrecognized language specified in CREATE FUNCTION: 'plpgsql'.
Pre-installed languages are SQL,C, and internal.
Additional languages may be installed using 'createlang'.

I went to the pdocs and read about createlang script, and found createlang
script in my

/usr/local/pgsql/bin

but when I type various things to try to even list my installed languages -
let alone install plpgsql - which I thought came automatically installed? -
I keep getting

Command not found.

I ls and I see createlang in the dir I'm in.

I type things like: (my db is named rbl)

createlang -l rbl
createlang -l -drbl
createlang -l -d rbl
createlang -l template1
createlang -l
createlang

all return the same "Command not found"

Glad this is a newbie list... ????

Thank you,

- April

At 07:51 PM 4/14/2002 +0200, you wrote:
>Took me 10 min to complete
>
>CREATE FUNCTION substr_start(varchar,varchar,int4) RETURNS varchar AS '
>DECLARE
>     original alias for $1;
>     substring alias for $2;
>     startpoint alias for $3;
>     return_str varchar;
>BEGIN
>  return strpos(substr(original,startpoint,length(original)),substring);
>END;'
>LANGUAGE 'plpgsql'
>
>
>CREATE FUNCTION reverse_str(varchar) RETURNS varchar AS '
>DECLARE
>       original alias for $1;
>       reverse_str varchar;
>       i int4;
>BEGIN
> reverse_str = '''';
> FOR i IN REVERSE LENGTH(original)..1 LOOP
>  reverse_str = reverse_str || substr(original,i,1);
> END LOOP;
> return reverse_str;
>END;'
>LANGUAGE 'plpgsql';
>
>
>
>http://www.pgexplorer.com
>GUI postgresql tool
>
>
>----- Original Message -----
>From: "April L" <april@i-netco.com>
>To: <pgsql-novice@postgresql.org>
>Sent: Sunday, April 14, 2002 7:02 PM
>Subject: [NOVICE] string functions
>
>
>> I have studied the Users Lounge and links off of it, looking for a place
>> where PG users are sharing extended functions they have created for PG.
>>
>> In particular I am looking for string functions such as being able to
>> specify a start point for finding a substring within a string. The
>existing
>> PGSQL function position(substring,string) nor strpos(string,substring)
>have
>> the option of specifying a start point for the search.
>>
>> Also I am looking for a function to reverse a string, so that for example
>> reverse("april") returns "lirpa"
>>
>> Can anyone point me to an area where users are sharing functions they
>> created, especially the ones I'm looking for? At this point I'm not able
>to
>> write one for myself. I am stuck using Cold Fusion which does include the
>> functions I need, but is so slow at it that it times out before completing
>> the update to all of my 250,000 records.
>>
>> Thank you,
>>
>> - April
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>

Re: plpgsql and createlang?

From
"P. Jourdan"
Date:
April,

Try http://www.kurup.com/acs/openacs4/postgres.html

I had to install pl/psql and knew nothing about it.  I think you'll find
almost everything on the net. Although I find Unix(FreeBSD) terribly
complex, I usually find the answer to my problems by just good old "common
sense" and a lot of searching... :))
Philip Jourdan

At 03:05 PM 4/14/2002 -0400, you wrote:


>I went to the pdocs and read about createlang script, and found createlang
>script in my
>
>/usr/local/pgsql/bin
>
>but when I type various things to try to even list my installed languages -
>let alone install plpgsql - which I thought came automatically installed? -
>I keep getting
>
>Command not found.
>
>I ls and I see createlang in the dir I'm in.
>
>I type things like: (my db is named rbl)
>
>createlang -l rbl
>createlang -l -drbl
>createlang -l -d rbl
>createlang -l template1
>createlang -l
>createlang
>
>all return the same "Command not found"


Re: plpgsql and createlang?

From
April L
Date:
Thank you, Philip. With your help, I finally realized I was at the wrong
kind of prompt. I now am able to get the list of installed languages from
createlang, although I still have to get myself to be a superuser to add
plpgsql... my *nix guys are sleeping and of course I can't simply wait for
them to wake up - esp with the fun new functions I have available to play
with now!

- April

At 03:17 PM 4/14/2002 -0400, P. Jourdan wrote:
>April,
>
>Try http://www.kurup.com/acs/openacs4/postgres.html
>
>I had to install pl/psql and knew nothing about it.  I think you'll find
>almost everything on the net. Although I find Unix(FreeBSD) terribly
>complex, I usually find the answer to my problems by just good old "common
>sense" and a lot of searching... :))
>Philip Jourdan


Re: plpgsql and createlang?

From
"P. Jourdan"
Date:
At 03:43 PM 4/14/2002 -0400, you wrote:
>Thank you, Philip. With your help, I finally realized I was at the wrong
>kind of prompt. I now am able to get the list of installed languages from
>createlang, although I still have to get myself to be a superuser to add
>plpgsql... my *nix guys are sleeping and of course I can't simply wait for
>them to wake up - esp with the fun new functions I have available to play
>with now!

I have a great deal of difficulty understanding the superuser thing,
myself. I know what the superuser is on the system - but I don't understand
the superuser thing under Postgrsql. I think you become the superuser on
Postgresql when you fist set up a user on the system as pgsql or posgres
(the common usage seems to have gone from postgres on earlier versions to
pgsql on recent versions). Then you have to use that user to create the
initial database and you have to set the chown to that user.
I think... :( ...  I have to play with that myself to try to understand as
I am trying to restore a datqabase and it seems to depent on the correct
user and permissions.
I hope some will explain this stuff to us... :))
Philip