![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Tom Lane wrote: Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes: How about if we add a UNION that does: UNION SELECT 'non-local temp schemas skipped', NULL I think showing that would only be appropriate if we actually *did* skip some. Finding that out would complicate the query unduly IMHO. I see a few goals here: Prevent \dn from showing lots of lines for large installs Show the local temp schema so people can query it If those are agreed to be the goals then we end up with your original solution (or a working implementation of same anyway). I'd like to see some input from other people about what they want... I have added this to the TODO list: * Have psql \dn show only visible schemas using current_schemas() I know there was talk of showing all schemas only in admin mode, but I don't think we want to implement different behavior until we have a more practical reason to have such a mode distiction. Of course, \dn will have to be documented that is supresses non-visible schemas, and admins can always do a select from pg_namespace. |
#2
| |||
| |||
|
|
This patch uses current_schemas('true') to display only the schemas in the current search path and implicit schemas. |
#3
| |||
| |||
|
|
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes: This patch uses current_schemas('true') to display only the schemas in the current search path and implicit schemas. The more I look at this, the sillier it looks. It converts \dn into an expensive substitute for "select current_schemas(true)". In practical situations this will mean that \dn shows hardly anything of interest. I think the original complaint was misguided and we should not do anything about it. IIRC the complaint amounted to "I have hundreds of schemas and it annoys me that \dn shows them all". How is this different from putting hundreds of tables into one schema and then being annoyed because \dt shows them all? We have other mechanisms available for making \dn selective (ie, you can use a name pattern). If \dn is restricted to showing only schemas in your search path, it will become useless. |
#4
| |||
| |||
|
|
Agreed showing just search path and implicit schemas is pretty dumb. I think the issue was that every backend with a temp table was showing up, pretty much swamping the actual schemas he is using. |
#5
| |||
| |||
|
|
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes: Agreed showing just search path and implicit schemas is pretty dumb. I think the issue was that every backend with a temp table was showing up, pretty much swamping the actual schemas he is using. Oh, okay. I would not object to suppressing pg_temp_NNN schemas from the \dn display. That isn't what this patch does, however. |
#6
| |||
| |||
|
|
Tom Lane wrote: Oh, okay. I would not object to suppressing pg_temp_NNN schemas from the \dn display. That isn't what this patch does, however. OK. I read the TODO and it says only: * Have psql \dn show only visible schemas using current_schemas() |
|
so that's what I did, but I think now I have to add a test so only non-visible temp schemas are suppressed, |
#7
| |||
| |||
|
|
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes: Tom Lane wrote: Oh, okay. I would not object to suppressing pg_temp_NNN schemas from the \dn display. That isn't what this patch does, however. OK. I read the TODO and it says only: * Have psql \dn show only visible schemas using current_schemas() That TODO was your interpretation of the discussion; I'm not sure anyone else bought into it. so that's what I did, but I think now I have to add a test so only non-visible temp schemas are suppressed, You are complicating something that could be simple. Why not just suppress schemas named 'pg_temp_XXX', period? I don't see any strong reason to display them, whether they are your own backend's temp schema or not. Arguably, the fact that temp tables are kept in a special schema is an implementation detail that most people won't care about. And there is no data that \dn can show that is really important for temp schemas. The owner column is at best misleading... |
#8
| |||
| |||
|
|
Also, how do we know something is a temp schema? Just the prefix pg_temp_*? |
#9
| |||
| |||
|
|
Bruce Momjian <pgman (AT) candle (DOT) pha.pa.us> writes: Also, how do we know something is a temp schema? Just the prefix pg_temp_*? Yeah. Remember that all schemas named pg_XXX are reserved for system use. For the moment, testing for pg_temp_XXX is a bulletproof test, and we can certainly adapt psql's test if we ever add schemas that might conflict. Looking at the present output of \dn, I wonder whether we should not suppress the pg_toast schema as well. That could be done (at the moment) by bouncing all schemas 'pg_t*' ... |
#10
| |||
| |||
|
|
so that's what I did, but I think now I have to add a test so only non-visible temp schemas are suppressed, You are complicating something that could be simple. Why not just suppress schemas named 'pg_temp_XXX', period? |
![]() |
| Thread Tools | |
| Display Modes | |
| |