My background is Oracle on a Windows platform. We are starting to use Postgres on Linux. In Oracle you have the ability to do the following:
spool c:\myjunk\file.txt
select col1, col3, col5
from table1
order by col1,col5;
spool off
The output from the select sql goes to file.txt.
Now in postgres all I can see is the ability to dump or copy. Neither of which gives me the flexibility on controling the output any way I want. And in phppgadmin I could not find anything similar as well.
I would appreciate any insight on how I might accomplish what I want both natively in psql and via phppgadmin. phppgadmin is my desktop tool for accessing postgres so it is important I understand if the capabilities exist there. We are phppgadmin 3.3.1
Thanks in advance for the help, Laura
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
well you really should eb asking the postgresql lists, but hey.
Firstly, I don't see how your example lets you format the output "any way you want", so phpPgAdmin download sql function woudl seem to be ok...
In psql you can do this:
\o c:\myjunk\file.txt
select ...
\q
(i'm not sure how to turn OFF spooling, but just quitting will do it)
You may as well upgrade to phpPgadmin 3.5 btw, 3.3 is pretty old.
You may wish to also google for pgAdmin3 - it is a great windows-based postgresql admin. Or even the commercial product EMS PostgreSQL manager that can output to a multitude of formats.
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the feedback. From your comments and what I can see in my version of pgadmin, I can spool output in psql and be able to specify my SELECT statement with the columns I want, and specify the order and where clauses specifics. But within pgadmin, with the Export option, by specifying 'download', I get all the rows and columns of a table. I don't see how I can take the output of a sql statement I write and spool it off to a file from within pgadmin.
Am I missing something obvious here?
Laura
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My background is Oracle on a Windows platform. We are starting to use Postgres on Linux. In Oracle you have the ability to do the following:
spool c:\myjunk\file.txt
select col1, col3, col5
from table1
order by col1,col5;
spool off
The output from the select sql goes to file.txt.
Now in postgres all I can see is the ability to dump or copy. Neither of which gives me the flexibility on controling the output any way I want. And in phppgadmin I could not find anything similar as well.
I would appreciate any insight on how I might accomplish what I want both natively in psql and via phppgadmin. phppgadmin is my desktop tool for accessing postgres so it is important I understand if the capabilities exist there. We are phppgadmin 3.3.1
Thanks in advance for the help, Laura
well you really should eb asking the postgresql lists, but hey.
Firstly, I don't see how your example lets you format the output "any way you want", so phpPgAdmin download sql function woudl seem to be ok...
In psql you can do this:
\o c:\myjunk\file.txt
select ...
\q
(i'm not sure how to turn OFF spooling, but just quitting will do it)
You may as well upgrade to phpPgadmin 3.5 btw, 3.3 is pretty old.
You may wish to also google for pgAdmin3 - it is a great windows-based postgresql admin. Or even the commercial product EMS PostgreSQL manager that can output to a multitude of formats.
Chris
Thanks for the feedback. From your comments and what I can see in my version of pgadmin, I can spool output in psql and be able to specify my SELECT statement with the columns I want, and specify the order and where clauses specifics. But within pgadmin, with the Export option, by specifying 'download', I get all the rows and columns of a table. I don't see how I can take the output of a sql statement I write and spool it off to a file from within pgadmin.
Am I missing something obvious here?
Laura
Yes. Use the 'SQL' tab on a database. Tick the 'paginate results' tick box. Put in your select statement. Press Go. Click 'Download'.
Chris
Thanks again for the feedback. Your last comment did the trick.
Laura