Skip site navigation (1) Skip section navigation (2)

Help working with arrays / vectors

From: Brett Krebs <bkrebs(at)RINECO(dot)COM>
To: pgsql-novice(at)postgresql(dot)org
Subject: Help working with arrays / vectors
Date: 2002-06-24 20:12:28
Message-ID: 01CC21318F15D6118A3D00E0293067544BC722@SULU (view raw or flat)
Thread:
Lists: pgsql-novice
Hello all, I am trying to write a function akin to M$'s (or Sybase's)
sp_helptext, which basically returns the definition of a stored procedure
(or function, in this case.)  Using pl/pgSQL I have written a function that
returns the body of a given function by returning the corresponding prosrc
attribute from pg_proc.  The difficulty comes in figuring out a way to also
return the parameters required by the function.  I am aware that the
pronargs attribute contains the number of arguments, and the proargtypes
attribute contains an array (vector) of the oids of the argument types.
That's where I get stuck, I haven't found any documentation detailing a
method for manipulating vectors in pl/pgSQL.  Is there a way to fetch an
oidvector type directly into an array and then manipulate the array?  If
not, is there a "best method" for fetching the oidvector into a text
variable and parsing it to create an array?  
 
Better yet, has anyone out there who knows what they're doing already
written a similar function.  I'm not too proud to borrow code.
 
Thanks in advance,
Brett

Responses

pgsql-novice by date

Next:From: Josh BerkusDate: 2002-06-24 21:29:52
Subject: Re: Expect and scripting.
Previous:From: Guthrie, JohnDate: 2002-06-24 17:55:25
Subject: Re: Expect and scripting.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group