Re: Query to check existence of stored procedure?

From: "Jim Buttafuoco" <jim(at)contactbda(dot)com>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, Alexander Scholz <alexander(dot)scholz1(at)freenet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query to check existence of stored procedure?
Date: 2006-04-21 11:46:23
Message-ID: 20060421114556.M74543@contactbda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


nice, this could be put into a plpgsql function with error handling.

---------- Original Message -----------
From: "Jim C. Nasby" <jnasby(at)pervasive(dot)com>
To: Alexander Scholz <alexander(dot)scholz1(at)freenet(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Sent: Fri, 21 Apr 2006 00:54:51 -0500
Subject: Re: [GENERAL] Query to check existence of stored procedure?

> If you're on a more recent version, you can try and select the procname
> for a proc and trap the error:
>
> decibel=# select 'abs(bigint)'::regprocedure;
> regprocedure
> --------------
> abs(bigint)
> (1 row)
>
> decibel=# select 'abs(text)'::regprocedure;
> ERROR: function "abs(text)" does not exist
> decibel=#
>
> If you don't care about arguments you can use regproc.
>
> On Tue, Apr 18, 2006 at 08:26:49AM +0200, Alexander Scholz wrote:
> > Hi Newsgroup,
> >
> > I need a query which can check for the existence of a certain stored
> > procedure.
> >
> > (The pendant for MS SQL is
> >
> > IF EXISTS (SELECT * FROM "sysobjects" WHERE "id" =
> > object_id(N'"MyTestStoredProcedure"') and OBJECTPROPERTY("id",
> > N'IsProcedure') = 1)
> > ...
> > )
> >
> > Any help would be appreciated! :-)
> >
> > Thanx in advance,
> >
> > Alexander.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 9: In versions below 8.0, the planner will ignore your desire to
> > choose an index scan if your joining column's datatypes do not
> > match
> >
>
> --
> Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
> Pervasive Software http://pervasive.com work: 512-231-6117
> vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
------- End of Original Message -------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harald Armin Massa 2006-04-21 12:35:50 Re: psql: FATAL: missing or erroneous pg_hba.conf file
Previous Message Jim Buttafuoco 2006-04-21 11:45:34 Re: Query to check existence of stored procedure?