2

I know how to export a table via PhpPgAdmin.

Is there a way I can export a view data out of PhpPgAdmin.

Thanks.

lud0h
  • 2,370
  • 6
  • 33
  • 41

2 Answers2

8

There is an option to do it through phpPGadmin as well.

  1. Make the view
  2. Select the view
  3. underneath your columns selected for the view there is an option 'select'
  4. in this select screen select the option " Select All Fields"
  5. run the select
  6. you get the results 30 per page
  7. at the bottom of the results there is an option 'download'
  8. select your kind of export you want (CSV, XHTML, ...)
  9. select download

I know its a late reply but i had to search myself this one and this was the first result from google so I hope this helps other google hitters :)

Eddy
  • 5,320
  • 24
  • 40
2
SELECT 
    definition 
FROM 
    pg_views 
WHERE 
    schemaname = 'public' 
AND
    viewname = 'your_view';
Frank Heikens
  • 117,544
  • 24
  • 142
  • 135
  • Hi, this extracts the definition. I would like to extract the data out of the view. – lud0h Nov 29 '10 at 10:19
  • @ludoh: There is no data "in" the view. The view is just a, well, *view* on data that physically exists in other tables. If you want the data, just use `SELECT * FROM myview;` and export as usual. – j_random_hacker Nov 29 '10 at 10:35
  • @j_random_hacker: I tried but it gave me an error 'ERROR: relation "myview" does not exist', I am logged in as admin. I tried prefixing with schema name and same error. Do I have to provide any grants to the view? – lud0h Nov 29 '10 at 11:46
  • 1
    Did you connect to the correct database? It looks like your view doesn't exist or you made a typo. – Frank Heikens Nov 29 '10 at 11:52
  • @lud0h: Yes, you'll need access rights, but I imagine that if you can run Frank's query then you have all the rights you need. – j_random_hacker Nov 29 '10 at 11:59
  • @Frank, @j_random_hacker: Duh! I need to enclose the view name with double quotes! – lud0h Nov 29 '10 at 12:59