| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> | 
|---|---|
| To: | Bhupendra Babu <bbabu12(at)gmail(dot)com> | 
| Cc: | pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: how to use function from different database | 
| Date: | 2020-07-31 00:15:49 | 
| Message-ID: | CAKFQuwbNejV7bLPaKegD22w6syD5OigvezuYst+iFty0miWcOw@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
On Thu, Jul 30, 2020 at 5:04 PM Bhupendra Babu <bbabu12(at)gmail(dot)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.
See: https://www.postgresql.org/docs/12/manage-ag-overview.html
David J.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rob Sargent | 2020-07-31 00:28:44 | Re: how to use function from different database | 
| Previous Message | Bhupendra Babu | 2020-07-31 00:03:41 | how to use function from different database |