Re: [GENERAL] Temporary tables and miscellaneous schemas - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: [GENERAL] Temporary tables and miscellaneous schemas |
Date | |
Msg-id | 200312220702.hBM72cl22763@candle.pha.pa.us Whole thread Raw |
In response to | Re: [GENERAL] Temporary tables and miscellaneous schemas (Sean Chittenden <sean@chittenden.org>) |
Responses |
Re: [GENERAL] Temporary tables and miscellaneous schemas
Re: [GENERAL] Temporary tables and miscellaneous schemas |
List | pgsql-patches |
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, > thus exposing that information would strike me as a liability and not > an asset. And then there's the idea of providing an admin-mode that > exposes all of the implementation details (Hint, hint. I'd do the leg > work on this if it wouldn't be categorically dropped at the front > door). Anyway, I know we've covered this in the archives so I'll drop > it. > > 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 decision > to make, but I'd settle and shut up if there was an indirect proof for > why this shouldn't be included as a patch (ie, a valid usecase for an > admin or programmer who would need to see any or all of the pg_temp_* > schemas without using that data to extract more bits from the > pg_catalogs. If they know how to go through the catalogs, why do they > need \dn to display the temp schemas?). 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. There is now cleaner way to join to the current_schemas() array, right? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/bin/psql/describe.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/psql/describe.c,v retrieving revision 1.90 diff -c -c -r1.90 describe.c *** src/bin/psql/describe.c 1 Dec 2003 22:21:54 -0000 1.90 --- src/bin/psql/describe.c 22 Dec 2003 06:58:48 -0000 *************** *** 1626,1639 **** 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", _("Name"), _("Owner")); ! processNamePattern(&buf, pattern, false, false, NULL, "n.nspname", NULL, NULL); --- 1626,1650 ---- 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" ! "WHERE n.nspname NOT LIKE 'pg_temp_%%'\n" ! "UNION ALL\n" /* show only local temp schema */ ! "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" ! " (SELECT current_schemas('t'::boolean)) AS curr_schemas(name)\n" ! "WHERE n.nspname LIKE 'pg_temp_%%' AND\n" ! " n.nspname = ANY(curr_schemas.name)\n", ! _("Name"), ! _("Owner"), _("Name"), _("Owner")); ! processNamePattern(&buf, pattern, true, false, NULL, "n.nspname", NULL, NULL);
pgsql-patches by date: