Re: how to use function from different database - Mailing list pgsql-sql

From David G. Johnston
Subject Re: how to use function from different database
Date
Msg-id CAKFQuwbNejV7bLPaKegD22w6syD5OigvezuYst+iFty0miWcOw@mail.gmail.com
Whole thread Raw
In response to how to use function from different database  (Bhupendra Babu <bbabu12@gmail.com>)
List pgsql-sql
On Thu, Jul 30, 2020 at 5:04 PM Bhupendra Babu <bbabu12@gmail.com> wrote:
I created a generic function (DATEFIFF) login to postgres database using psql. ANd I wanted to use across the entire instance , from all other databases.

postgres=> CREATE FUNCTION DateDiff (units VARCHAR(30), start_t TIMESTAMP, end_t TIMESTAMP)
How can I use this function across my entire postgresql instance from any databases ?

So far as a SQL user is concerned Individual databases are isolated from each other.  If you want to use the custom function in a database you need to issue the "CREATE FUNCTION" command in that database.


David J.

pgsql-sql by date:

Previous
From: Bhupendra Babu
Date:
Subject: how to use function from different database
Next
From: Rob Sargent
Date:
Subject: Re: how to use function from different database