Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some general help with views

Status
Not open for further replies.

meeII

Programmer
Jul 12, 2006
2
CA
Hi everyone,

Pretty new to PostgreSQL and have a few general questions about views.

1. Are views stored? ie: if my server crashes will the views associated with my database stay intact? I guess, more or less, will the view survive as long as the database survives?

2. I know you can see the values in a view by SELECT but can you see which view references a specific value. For instance, I have two views (Home and Office) and have a value "computer" in both views, is there a way to query the value "computer" to give me "Home" and "Office"?

Thanks in advance!
Dan
 
Hi

Dan said:
Are views stored?
Yes or no. Yes, views are stored in the database. But note that the view is only a saved [tt]select[/tt] statement, so no data will be saved with it.
Dan said:
can you see which view references a specific value
I am not sure about what you want to see, but think is [tt]\d[/tt] in the [tt]psql[/tt] terminal :
Code:
\d [green][i]viewname[/i][/green]

Feherke.
 
Thanks!

I am wondering whether you can query a value to return the views it belongs to.

View "Home"
Name | Qty | ...
----------------------------------------
Computer | 2 | ...
TV | 3 | ...

View "Office"
Name | Qty | ...
-----------------------------------------
Computer | 2 | ...
Desk | 1 | ...


Is there a way to query the value "TV" to return "Home" and so on? Thanks!
 
Hi

So you want so many information. Then look in the pg_statio_ views system table (?). If not satisfied, type [tt]\dS[/tt] at the [tt]psql[/tt] terminal's prompt to see all system tables/views. The names are quite informative so you will find easily which may help you.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top