Re: [PATCHES] [HACKERS] Multiline privileges in \z

2008-05-04 Thread Andrew Dunstan



Brendan Jurd wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Apr 18, 2008 at 2:37 AM, Tom Lane  wrote:
  

 The function names in the patch need schema-qualification in case
 pg_catalog is not first in the search path.




Ah, yes.  I should have seen that.  Thanks Tom.

New version attached with schema-qualification.

  
  


Committed with slight editorialization and a consequent docs change.

cheers

andrew

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] [HACKERS] Multiline privileges in \z

2008-05-04 Thread Brendan Jurd
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sun, May 4, 2008 at 10:55 AM, Tom Lane  wrote:
> Andrew Dunstan  writes:
>  > Wouldn't this expression:
>  >   pg_catalog.array_to_string(c.relacl, chr(10))
>  > be better expressed as
>  >   pg_catalog.array_to_string(c.relacl, E'\n')
>
>  +1 ... it's minor, but knowing that ASCII LF is 10 is probably not
>  wired into too many people's brains anymore.  (Besides, some of us
>  remember it as octal 12, anyway...)
>

Fair enough.  I just wanted a non-messy way of saying "1 newline,
please", and I wasn't too sure whether backslash escapes were
considered kosher for internal queries.

But you're right, readability is important.  No objections to using
the escape syntax.

Please note that I used chr(10) in my \du attributes patch as well.

Cheers,
BJ

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIHjNA5YBsbHkuyV0RAuNSAJ0ZDLxhHaPj4CBsBCILnxHy+5Jf5ACfQHMH
4XZxczc+YEow3AFdayn9fGs=
=+TSV
-END PGP SIGNATURE-

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] [HACKERS] Multiline privileges in \z

2008-05-03 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes:
> Wouldn't this expression:
>   pg_catalog.array_to_string(c.relacl, chr(10))
> be better expressed as
>   pg_catalog.array_to_string(c.relacl, E'\n')

+1 ... it's minor, but knowing that ASCII LF is 10 is probably not
wired into too many people's brains anymore.  (Besides, some of us
remember it as octal 12, anyway...)

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] [HACKERS] Multiline privileges in \z

2008-05-03 Thread Andrew Dunstan



Brendan Jurd wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Apr 18, 2008 at 2:37 AM, Tom Lane  wrote:
  

 The function names in the patch need schema-qualification in case
 pg_catalog is not first in the search path.




Ah, yes.  I should have seen that.  Thanks Tom.

New version attached with schema-qualification.
  


Wouldn't this expression:


pg_catalog.array_to_string(c.relacl, chr(10))


be better expressed as


pg_catalog.array_to_string(c.relacl, E'\n')

?

Quoted inside a C literal, the backslash would have to be doubled, of course.

cheers

andrew




--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] [HACKERS] Multiline privileges in \z

2008-04-17 Thread Brendan Jurd
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri, Apr 18, 2008 at 2:37 AM, Tom Lane  wrote:
>  The function names in the patch need schema-qualification in case
>  pg_catalog is not first in the search path.
>

Ah, yes.  I should have seen that.  Thanks Tom.

New version attached with schema-qualification.

Cheers,
BJ
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: http://getfiregpg.org

iD8DBQFIB4Ae5YBsbHkuyV0RAqJVAJ9+h6wZrLT9YFRw3s2E742sg7Yr4wCgvtcq
xK7cTnbiGtfpGGYw5WP4asI=
=hf8W
-END PGP SIGNATURE-
*** src/bin/psql/describe.c
--- src/bin/psql/describe.c
***
*** 482,488  permissionsList(const char *pattern)
  "SELECT n.nspname as \"%s\",\n"
  "  c.relname as \"%s\",\n"
  "  CASE c.relkind WHEN 'r' THEN '%s' 
WHEN 'v' THEN '%s' WHEN 'S' THEN '%s' END as \"%s\",\n"
! "  c.relacl as \"%s\"\n"
  "FROM pg_catalog.pg_class c\n"
   " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = 
c.relnamespace\n"
  "WHERE c.relkind IN ('r', 'v', 
'S')\n",
--- 482,488 
  "SELECT n.nspname as \"%s\",\n"
  "  c.relname as \"%s\",\n"
  "  CASE c.relkind WHEN 'r' THEN '%s' 
WHEN 'v' THEN '%s' WHEN 'S' THEN '%s' END as \"%s\",\n"
! "  
pg_catalog.array_to_string(c.relacl, chr(10)) as \"%s\"\n"
  "FROM pg_catalog.pg_class c\n"
   " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = 
c.relnamespace\n"
  "WHERE c.relkind IN ('r', 'v', 
'S')\n",
*** src/test/regress/expected/dependency.out
--- src/test/regress/expected/dependency.out
***
*** 68,86  NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 
"deptest_pkey" fo
  GRANT ALL ON deptest1 TO regression_user2;
  RESET SESSION AUTHORIZATION;
  \z deptest1
!   Access privileges 
for database "regression"
!  Schema |   Name   | Type  |  
   Access privileges
  
! 
+--+---+
!  public | deptest1 | table | 
{regression_user0=arwdxt/regression_user0,regression_user1=a*r*w*d*x*t*/regression_user0,regression_user2=arwdxt/regression_user1}
  (1 row)
  
  DROP OWNED BY regression_user1;
  -- all grants revoked
  \z deptest1
!   Access privileges for database "regression"
!  Schema |   Name   | Type  | Access privileges  
! +--+---+
!  public | deptest1 | table | {regression_user0=arwdxt/regression_user0}
  (1 row)
  
  -- table was dropped
--- 68,88 
  GRANT ALL ON deptest1 TO regression_user2;
  RESET SESSION AUTHORIZATION;
  \z deptest1
! Access privileges for database "regression"
!  Schema |   Name   | Type  |   Access privileges
! +--+---+
!  public | deptest1 | table | regression_user0=arwdxt/regression_user0
!: regression_user1=a*r*w*d*x*t*/regression_user0
!: regression_user2=arwdxt/regression_user1
  (1 row)
  
  DROP OWNED BY regression_user1;
  -- all grants revoked
  \z deptest1
!  Access privileges for database "regression"
!  Schema |   Name   | Type  |Access privileges 
! +--+---+--
!  public | deptest1 | table | regression_user0=arwdxt/regression_user0
  (1 row)
  
  -- table was dropped

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


Re: [PATCHES] [HACKERS] Multiline privileges in \z

2008-04-17 Thread Tom Lane
"Brendan Jurd" <[EMAIL PROTECTED]> writes:
> It occurred to me that psql's \z command could benefit from the
> addition of some newlines.  With any more than one grantee per object,
> the output of \z rapidly becomes extremely wide, and very hard to
> read.

Seems like a good idea now that psql deals nicely with multiline output.

The function names in the patch need schema-qualification in case
pg_catalog is not first in the search path.

regards, tom lane

-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches