public inbox for [email protected]  
help / color / mirror / Atom feed
Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION
3+ messages / 2 participants
[nested] [flat]

* Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION
@ 2024-09-04 12:50 [email protected]
  2024-09-04 13:15 ` Re: Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION David G. Johnston <[email protected]>
  2024-09-04 13:25 ` Re: Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION [email protected]
  0 siblings, 2 replies; 3+ messages in thread

From: [email protected] @ 2024-09-04 12:50 UTC (permalink / raw)
  To: [email protected]

Hello everyone!
----
I need to change the session user in the script, depending on whether it is
defined.
I'm trying to do it this way:
---
```
down
$body$
declare
_username;
begin
if 'reporter' in (select usename from pg_catalog.pg_user) then
raise notice 'user: reporter' ;
_user := '"srg"'::name;
else
raise notice 'user: postgres' ;
_user := 'postgres'::name;
end if;

SET SESSION AUTHORIZATION _user::name;
end;
$body$
;
```
---
Unfortunately, I don't know how to convert it so that SET SESSION
AUTHORIZATION works properly.

I am asking for support.

--
Regards,
keypey


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION
  2024-09-04 12:50 Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION [email protected]
@ 2024-09-04 13:15 ` David G. Johnston <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: David G. Johnston @ 2024-09-04 13:15 UTC (permalink / raw)
  To: [email protected] <[email protected]>; +Cc: [email protected] <[email protected]>

On Wednesday, September 4, 2024, <[email protected]> wrote:

>
> _user := 'postgres'::name;
> end if;
>
> SET SESSION AUTHORIZATION _user::name;
> end;
> $body$
> ;
> ```
> ---
> Unfortunately, I don't know how to convert it so that SET SESSION
> AUTHORIZATION works properly.
>
>
Dynamic SQL, I.e., the execute statement.

David J.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION
  2024-09-04 12:50 Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION [email protected]
@ 2024-09-04 13:25 ` [email protected]
  1 sibling, 0 replies; 3+ messages in thread

From: [email protected] @ 2024-09-04 13:25 UTC (permalink / raw)
  To: David G. Johnston <[email protected]>; +Cc: [email protected] <[email protected]>; [email protected] <[email protected]>

David
Thanks a lot!

--

kp

śr., 4 wrz 2024 o 15:15 David G. Johnston <
[email protected]> napisał(a):

> On Wednesday, September 4, 2024, wrote: _user := 'postgres'::name;end if;
> SET SESSION AUTHORIZATION _user::name;end;$body$;```---Unfortunately, I
> don't know how to convert it so that
> *DuckDuckGo* did not detect any trackers. More
> <https://duckduckgo.com/-FlJrDWmRvC6aB61K_vO3h5hJBFovO23anYwx1OQTF5ZP4Ua_XnuHMbQyiMwpRc9dlzYcsX9BjSCu...;
> Report Spam
> <https://duckduckgo.com/-FlJrDWmRvC6aB61K_vO3h5hJBFovO23anYwx1OQTF5ZP4Ua_XnuHMbQyiMwpRc9dlzYcsX9BjSCu...;
> On Wednesday, September 4, 2024, <[email protected]> wrote:
>
>>
>> _user := 'postgres'::name;
>> end if;
>>
>> SET SESSION AUTHORIZATION _user::name;
>> end;
>> $body$
>> ;
>> ```
>> ---
>> Unfortunately, I don't know how to convert it so that SET SESSION
>> AUTHORIZATION works properly.
>>
>>
> Dynamic SQL, I.e., the execute statement.
>
> David J.
>


-- 
kp.,



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-09-04 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-04 12:50 Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION [email protected]
2024-09-04 13:15 ` David G. Johnston <[email protected]>
2024-09-04 13:25 ` [email protected]

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