pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wolfgang Walther <walther@technowledgy.de>
To: Abdul Qoyyuum <aqoyyuum@cardaccess.com.au>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: ALTER ROLE ... SET in current database only
Date: Tue, 16 Feb 2021 09:41:07 +0100
Message-ID: <260e6e0d-acf7-40be-601e-9dd2c7ce2add@technowledgy.de> (raw)
In-Reply-To: <CAA3DN=XEWesNO_S6QTBRcOe=WO29hsW=JB-W9TBiaU+7_BhsQQ@mail.gmail.com>
References: <2b2fc152-63cb-1d4a-93c2-f57f28a98fce@technowledgy.de>
	<CAA3DN=XEWesNO_S6QTBRcOe=WO29hsW=JB-W9TBiaU+7_BhsQQ@mail.gmail.com>

Abdul Qoyyuum:
> Wouldnt you need to connect to the database first before you can ALTER 
> ROLE anything?

Of course, otherwise the notion of "current database" wouldn't make 
sense at all. But that's only before executing the code. I am not 
writing and executing this code at the same time.

In my case I'm seeding a postgres docker container with settings and 
data on first launch. The database name is passed to the container via 
environment variable. But, I'm sure there are other use-cases where code 
should be written once, but be executed in different databases.

Best,

Wolfgang





view thread (3+ messages)

Message-ID: <260e6e0d-acf7-40be-601e-9dd2c7ce2add@technowledgy.de>
Permalink:  ../260e6e0d-acf7-40be-601e-9dd2c7ce2add@technowledgy.de/
Also on:    postgresql.org/message-id/260e6e0d-acf7-40be-601e-9dd2c7ce2add@technowledgy.de

 · 

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: walther@technowledgy.de, aqoyyuum@cardaccess.com.au
  Subject: Re: ALTER ROLE ... SET in current database only
  In-Reply-To: <260e6e0d-acf7-40be-601e-9dd2c7ce2add@technowledgy.de>
  References: <2b2fc152-63cb-1d4a-93c2-f57f28a98fce@technowledgy.de> <CAA3DN=XEWesNO_S6QTBRcOe=WO29hsW=JB-W9TBiaU+7_BhsQQ@mail.gmail.com> <260e6e0d-acf7-40be-601e-9dd2c7ce2add@technowledgy.de>

* 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