pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ц <pfunk@mail.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject:  Re[2]: Invalid name syntax on to_regrole(session_user)
Date: Tue, 14 Apr 2020 17:32:56 +0300
Message-ID: <1586874776.795888157@f420.i.mail.ru> (raw)
In-Reply-To: <16503.1586873083@sss.pgh.pa.us>
References: <158686573592.9421.7178775688662332959@malur.postgresql.org>
	<1586868479.588975920@f425.i.mail.ru>
	<16503.1586873083@sss.pgh.pa.us>

Thank you for clarification!

PS: Re-reading initial message, I feel ashamed for such foolish questions.


>Вторник, 14 апреля 2020, 17:04 +03:00 от Tom Lane <tgl@sss.pgh.pa.us>:
>
>=?UTF-8?B?0KY=?= < pfunk@mail.ru > 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
>
>






Message-ID: <1586874776.795888157@f420.i.mail.ru>
Permalink:  ../1586874776.795888157@f420.i.mail.ru/
Also on:    postgresql.org/message-id/1586874776.795888157@f420.i.mail.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: pfunk@mail.ru, tgl@sss.pgh.pa.us
  Subject: Re: Invalid name syntax on to_regrole(session_user)
  In-Reply-To: <1586874776.795888157@f420.i.mail.ru>
  References: <158686573592.9421.7178775688662332959@malur.postgresql.org> <1586868479.588975920@f425.i.mail.ru> <16503.1586873083@sss.pgh.pa.us> <1586874776.795888157@f420.i.mail.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox