loading a function from a file

Поиск
Список
Период
Сортировка
Искать

loading a function from a file

От:
and <andreaesposito77@gmail.com>
Дата:
Hi all,
I would like to know how to load a user defined function from a file
written in pl/pgsql.

I have read it on logging
psql -h host database <  create_some_func.sql
but then i am forced to redo the login.Is there another way to do it?

Re: loading a function from a file

От:
Merlin Moncure <mmoncure@gmail.com>
Дата:
On Mon, Mar 26, 2012 at 4:32 AM, and  wrote:
> Hi all,
> I would like to know how to load a user defined function from a file
> written in pl/pgsql.
>
> I have read it on logging
> psql -h host database <  create_some_func.sql
> but then i am forced to redo the login.Is there another way to do it?

what is login.ls?  what exactly about the above is not working for you?

merlin

Re: loading a function from a file

От:
Andy Colson <andy@squeakycode.net>
Дата:
On 3/26/2012 4:32 AM, and wrote:
> Hi all,
> I would like to know how to load a user defined function from a file
> written in pl/pgsql.
>
> I have read it on logging
> psql -h host database<   create_some_func.sql
> but then i am forced to redo the login.Is there another way to do it?
>

You can put default passwords into a .pgpass file, then psql wont prompt 
you for it.

-Andy

Re: loading a function from a file

От:
Adrian Klaver <adrian.klaver@gmail.com>
Дата:
On 03/26/2012 02:32 AM, and wrote:
> Hi all,
> I would like to know how to load a user defined function from a file
> written in pl/pgsql.
>
> I have read it on logging
> psql -h host database<   create_some_func.sql
> but then i am forced to redo the login.Is there another way to do it?

Not sure what you are trying to achieve? If the file/function is outside 
the database and you want it inside, at some point you are going to have 
to log into the database to make the transfer. If you are working in the 
database using psql you can use the \i command:

test=> \i ~/some_dir/some_func_file.sql

If that is not what you are after, then we will need more detail.

>


-- 
Adrian Klaver
adrian.klaver@gmail.com

Re: loading a function from a file

От:
Alban Hertroys <haramrae@gmail.com>
Дата:
On 26 March 2012 11:32, and  wrote:
> I have read it on logging
> psql -h host database <  create_some_func.sql
> but then i am forced to redo the login.Is there another way to do it?

If you're working on the database server, then you can skip the "-h
host" bit and use a socket.

That does require that you didn't disallow those in pg_hba and that
the OS supports socket files (Windows doesn't, for example).

-- 
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

Re: loading a function from a file

От:
Jasen Betts <jasen@xnet.co.nz>
Дата:
On 2012-03-26, and  wrote:
> Hi all,
> I would like to know how to load a user defined function from a file
> written in pl/pgsql.
>
> I have read it on logging
> psql -h host database <  create_some_func.sql
> but then i am forced to redo the login.  Is there another way to do it?

another way use a connection string:
psql "host=name dbname=database password=SECRET" < create_some_func.sql

another is log into psql and issue the \i psql command to read the file

  \i create_some_func.sql

-- 
⚂⚃ 100% natural
FAQ