Lists: | pgsql-patches |
---|
From: | Daniel Baldoni <pgsql(at)lcds(dot)com(dot)au> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | First attempt: support for "\dg" in psql |
Date: | 2004-07-02 12:15:55 |
Message-ID: | 40E551FB.E4A45E75@lcds.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
G'day folks,
Attached is my first attempt at providing "\du"-like functionality for
groups (i.e. a basic "\dg"). It's really just a copy of describeUsers().
It has one major limitation - members are listed by numeric id as I can't
think of a "cheap" way of turning the list into the corresponding list of
usernames.
I thought about having describeGroups() do a lookup on pg_user, but that
could become quite expensive if there is a large number of groups and/or
users (have I missed an obvious facility for caching this information?).
Also, the TODO mentions that the intention is to have \du list groups - I
assume that means output along the lines of the following is wanted?
List of database users
User name | User ID | Attributes | Groups
-----------+---------+----------------------------+---------------
test | 100 | superuser, create database | testg1, testg2
Getting the group names for \du or the usernames for \dg are both
relatively easy with the appropriate JOIN, but the result is always a set
of rows. How to turn that into a single array? What would be handy is a
a library function returning an array, which takes an array, a table and two
two columns from that table:
F(A,T,C1,C2) returning an array of T.C2 values, one for each
value of T.C1 found in A.
With regard to criticism, please be gentle - this is only my second
contribution (the first being a very minor update to to_char). ;-)
Ciao.
--
-------------------------------------------------------+---------------------
Daniel Baldoni BAppSc, PGradDipCompSci | Technical Director
require 'std/disclaimer.pl' | LcdS Pty. Ltd.
-------------------------------------------------------+ 856B Canning Hwy
Phone/FAX: +61-8-9364-8171 | Applecross
Mobile: 041-888-9794 | WA 6153
URL: http://www.lcds.com.au/ | Australia
-------------------------------------------------------+---------------------
"Any time there's something so ridiculous that no rational systems programmer
would even consider trying it, they send for me."; paraphrased from "King Of
The Murgos" by David Eddings. (I'm not good, just crazy)
Attachment | Content-Type | Size |
---|---|---|
pg.diff | text/plain | 5.3 KB |
From: | Markus Bertheau <twanger(at)bluetwanger(dot)de> |
---|---|
To: | Daniel Baldoni <pgsql(at)lcds(dot)com(dot)au> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: First attempt: support for "\dg" in psql |
Date: | 2004-07-02 13:48:12 |
Message-ID: | 1088776092.2807.4.camel@teetnang |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
This is already in:
The - in front of that item on the todo list[1] means that it's already
done. This information probably needs to appear more prominently on the
todo page.
[1] http://developer.postgresql.org/todo.php
Thanks.
--
Markus Bertheau <twanger(at)bluetwanger(dot)de>
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Markus Bertheau <twanger(at)bluetwanger(dot)de> |
Cc: | Daniel Baldoni <pgsql(at)lcds(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: First attempt: support for "\dg" in psql |
Date: | 2004-07-06 16:18:42 |
Message-ID: | 200407061618.i66GIgA11685@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
I have moved the mention of the dash higher in the TODO file.
---------------------------------------------------------------------------
Markus Bertheau wrote:
> This is already in:
>
> http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/psql/describe.c.diff?r1=text&tr1=1.89&r2=text&tr2=1.90&f=h
>
> The - in front of that item on the todo list[1] means that it's already
> done. This information probably needs to appear more prominently on the
> todo page.
>
> [1] http://developer.postgresql.org/todo.php
>
> Thanks.
>
> --
> Markus Bertheau <twanger(at)bluetwanger(dot)de>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
> !DSPAM:40e56844212136178011369!
>
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From: | "Andrew Dunstan" <andrew(at)dunslane(dot)net> |
---|---|
To: | <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | <twanger(at)bluetwanger(dot)de>, <pgsql(at)lcds(dot)com(dot)au>, <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: First attempt: support for '\dg' in psql |
Date: | 2004-07-06 17:09:58 |
Message-ID: | 1306.68.16.180.225.1089133798.squirrel@www.dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Bruce Momjian said:
>
> I have moved the mention of the dash higher in the TODO file.
Maybe you could put the dash in a different color (red?) so it stands out
more. Or maybe the whole item could go in a different color if done.
cheers
andrew
From: | Markus Bertheau <twanger(at)bluetwanger(dot)de> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | pgman(at)candle(dot)pha(dot)pa(dot)us, pgsql(at)lcds(dot)com(dot)au, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: First attempt: support for '\dg' in psql |
Date: | 2004-07-07 09:10:45 |
Message-ID: | 1089191445.2717.2.camel@teetnang |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
В Втр, 06.07.2004, в 19:09, Andrew Dunstan пишет:
> Bruce Momjian said:
> >
> > I have moved the mention of the dash higher in the TODO file.
>
>
> Maybe you could put the dash in a different color (red?) so it stands out
> more. Or maybe the whole item could go in a different color if done.
Yes, what about stroke through:
done TODO item
--
Markus Bertheau <twanger(at)bluetwanger(dot)de>
From: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | Markus Bertheau <twanger(at)bluetwanger(dot)de> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, pgman(at)candle(dot)pha(dot)pa(dot)us, pgsql(at)lcds(dot)com(dot)au, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: First attempt: support for '\dg' in psql |
Date: | 2004-07-07 10:17:59 |
Message-ID: | 40EBCDD7.3030203@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
>>> I have moved the mention of the dash higher in the TODO file.
>>
>>
>>Maybe you could put the dash in a different color (red?) so it stands out
>>more. Or maybe the whole item could go in a different color if done./
>>
>
> Yes, what about stroke through:
Because neither works in the plain text version.
Chris
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Markus Bertheau <twanger(at)bluetwanger(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql(at)lcds(dot)com(dot)au, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: First attempt: support for '\dg' in psql |
Date: | 2004-07-07 12:50:21 |
Message-ID: | 200407071250.i67CoLt02817@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-patches |
Christopher Kings-Lynne wrote:
> >>> I have moved the mention of the dash higher in the TODO file.
> >>
> >>
> >>Maybe you could put the dash in a different color (red?) so it stands out
> >>more. Or maybe the whole item could go in a different color if done./
> >>
> >
> > Yes, what about stroke through:
>
> Because neither works in the plain text version.
OK, I updated to the newest version of txt2html and got the line to
appear in bold.
I also removed some blank lines and reordered the descriptions:
http://developer.postgresql.org/todo.php
Any other suggestions on how to improve this?
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073