Creating a function if it's not there in Postgres

From: "Robert James" <srobertjames(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Creating a function if it's not there in Postgres
Date: 2007-05-18 18:17:12
Message-ID: e09785e00705181117r6bec8bf7gcc93006196f8879c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I use a set of DDL scripts to automatically create the database for an app.

I need to create certain functions (from contrib), if they're not there
already. If they are there, I don't want to DROP or REPLACE them, since
they may be used in certain indexes and triggers.

Is there a way to only CREATE a function if it is not defined already?
Is there a simple way to see if the function is defined?

(I don't want to just try creating it and letting it fail, since the DDL
runs in a transaction).

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-05-18 18:22:03 Re: Creating a function if it's not there in Postgres
Previous Message ABHANG RANE 2007-05-18 18:05:49 contirb install