Basic question.

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

Basic question.

От:
andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
Дата:
Hi;
I'm sorry for ask this basic question. But I can't find in the documentation.

I'm connected to a database; and how can I execute a query that I've got in a 
file?

And. If I'm not connected to any database. Can I execute a file that makes a 
query on a database?


Thanks
-----------------
Javier

Re: Basic question.

От:
Tomasz Myrta <jasiek@klaster.net>
Дата:
Uz.ytkownik andres javier garcia garcia napisa?:
> Hi;
> I'm sorry for ask this basic question. But I can't find in the documentation.
> 
> I'm connected to a database; and how can I execute a query that I've got in a 
> file?
> 
> And. If I'm not connected to any database. Can I execute a file that makes a 
> query on a database?
But how are you connected to database?
If you are using tool named "psql" you can use "\i filename"
or you can do from command line psql  -U  

Tomasz Myrta


Re: Basic question.

От:
Tomasz Myrta <jasiek@klaster.net>
Дата:
> And. If I'm not connected to any database. Can I execute a file that makes a 
> query on a database?
Sorry, I made a mistake
psql -f  -U  
I'm not sure, but you can add export PGPASSWORD= before this 
command if you need a password.
Tomasz Myrta


FAQ