Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-23 Thread Christopher Kings-Lynne
initPQExpBuffer(buf); printfPQExpBuffer(buf, ! SELECT n.nspname AS \%s\,\n ! u.usename AS \%s\\n FROM pg_catalog.pg_namespace n LEFT JOIN pg_catalog.pg_user u\n ! ON n.nspowner=u.usesysid\n !

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-23 Thread Christopher Kings-Lynne
Not that this is incorrect. You need to go: LIKE 'pg_temp_%' probably. Got it. Yes. Sigh. It's so annoying living about 15 hours out from when all this stuff happens :P I read a thread, come across something, and then make a contribution, only to read about 40 threads down that the

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Bruce Momjian
Sean Chittenden wrote: Hiding pg_temp_* schemas seems like a good idea to me given temp objects are visible in every schema and the path of a temp object is subject to change... an overly diligent admin might try and hard code in the schema of a temp object only to find that path not portable,

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Bruce Momjian
Bruce Momjian wrote: As an FYI, I just updated to an Opteron box and have been enjoying a little over 1500 temp schemas and a paltry ~30 non-temp schemas. Getting this patch in would be oh so very appreciated as maintaining local copies of psql(1) is getting old. I know it's not my

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: OK, the following patch uses UNION and an =ANY() join to the current_schemas() array to suppress non-local temp schemas, but display all other schemas. Why are you doing any of this? We had agreed to suppress all temp schemas, period. The query should

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: OK, the following patch uses UNION and an =ANY() join to the current_schemas() array to suppress non-local temp schemas, but display all other schemas. Why are you doing any of this? We had agreed to suppress all temp schemas,

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Tom Lane wrote: Why are you doing any of this? We had agreed to suppress all temp schemas, period. The query should be simple. I know some feel that showing any temporary schemas is wrong, but it seems that the local temp schema has valuable

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Is current_schemas(true))[1] always the temp schema name? If you have a temp schema; otherwise it'll be whatever is the front of your search path. That would clean things up nicely. If you're intent on doing this in \dn, something like ... AND (nspname

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: ! WHERE n.nspname NOT LIKE 'pg_temp_%%' OR\n You forgot that '_' is a special character for LIKE. You need some backslashes there (4 apiece, I think). Also, there had better be parentheses around the whole OR clause; else I'm not sure that

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-22 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: !n.nspname = (current_schemas(true))[1]\n, /* temp schema is first */ One more thing: that needs to be pg_catalog.current_schemas to be search-path-proof. regards, tom lane

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-21 Thread Sean Chittenden
Because that's what I originally did and you shot it down as a bad patch because you thought it wasn't in PostgreSQL's interest to filter what we showed the user. I'm still unconvinced on that, actually ... but it beats the heck out of filtering everything not in your search path ...

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-21 Thread Sean Chittenden
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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Bruce Momjian
pgman wrote: Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Tom Lane
Sean Chittenden [EMAIL PROTECTED] writes: Because that's what I originally did and you shot it down as a bad patch because you thought it wasn't in PostgreSQL's interest to filter what we showed the user. I'm still unconvinced on that, actually ... but it beats the heck out of filtering

Re: [PATCHES] [GENERAL] Temporary tables and miscellaneous schemas

2003-12-20 Thread Sean Chittenden
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? Because that's what I originally did and you shot it down as a bad