Thread: Basic question.
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
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 <database> -U <user> <filename> Tomasz Myrta
> 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 <filename> -U <user> <database> I'm not sure, but you can add export PGPASSWORD=<password> before this command if you need a password. Tomasz Myrta