Search Postgresql Archives

Re: Invalid name syntax on to_regrole(session_user)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



=?UTF-8?B?0KY=?= <pfunk@xxxxxxx> writes:
> create role "dot.net"
> set session authorization 'dot.net';
> select to_regrole(session_user); ERROR: invalid name syntax

Well, we've got this:

regression=> select session_user;
 session_user 
--------------
 dot.net
(1 row)

which is reasonable: that output shouldn't be quoted.
But then:

regression=> select 'dot.net'::regrole;
ERROR:  invalid name syntax
LINE 1: select 'dot.net'::regrole;
               ^

which is also reasonable.  So you need to provide the quoting if
you want to interface these.

regression=> select to_regrole(quote_ident(session_user));
 to_regrole 
------------
 "dot.net"
(1 row)

> Is there other way (without extra type conversions) for getting oid of session_user?

select oid from pg_roles where rolname = session_user


			regards, tom lane






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux