Re: Database bar - Mailing list pgadmin-hackers

From Guillaume Lelarge
Subject Re: Database bar
Date
Msg-id 4DC30D83.7010404@lelarge.info
Whole thread Raw
In response to Database bar  (Erwin Brandstetter <brandstetter@falter.at>)
Responses Re: Database bar
List pgadmin-hackers
On 05/05/2011 05:25 PM, Erwin Brandstetter wrote:
> [...]
> - There is a new feature: the rolename. This effectively issues a
> command of the form:
>     SET ROLE TO myrole;
> after connecting with the chosen username. The database bar then reads
> accordingly:
>      "mydb on myuser@myserver:port ~myrole"
>
> However!
> - Most users will not understand the dialog. Why does it ask for a
> "Username" and a "Rolename"? It certainly took me some time to figure it
> out. Nothing in the help yet.

There is so much thing not in the help that it's not surprising. I guess
nothing in 1.14 is in the docs.

> - What if someone issues one of the following commands?
>     RESET role;
>     SET ROLE TO my_other_role;
> See for yourself:
>     SELECT current_user, session_user;
> The display in the database bar remains unchanged, rendering it wrong /
> misleading.

You already have this kind of issue in 1.12 and all previous releases.
You connect with a user, you do "SET ROLE TO another_role", and the
combobox doesn't change. You could still think you're user X, but you
really are user another_role.

The combobox only tells you how you established the connection, that's all.

> Changing to another connection and changing back does not change the
> situation.

Meaning?

> This could get quite hazardous. Imagine a command in the mistaken belief
> it would be executed by the displayed role ...
>

As I said, it could already happen in 1.12.

> If we keep this functionality the database bar would have to show the
> currently active role IMHO.

No, I won't add a parser to know if the user tried to do a "SET ROLE TO".

BTW, psql does the same as us:

guillaume@postgres=# create user toto;
CREATE ROLE
guillaume@postgres=# set role to toto;
SET
guillaume@postgres=>

See the prompt? it doesn't say toto@postgres. Quite misleading, uh? :)

Honestly, I think you're right that it's misleading and I would agree to
add a panel to the status bar to say who's the actual role. But it means
we will fire a "select current_user;" each time the user executes a
query or a group of queries. Not sure everyone would like that.

> Otherwise I would propose to drop it altogether to keep it safe and simple.
>

-1

> - Also, the "database bar" is too narrow to show the whole connection
> string, cutting off the relevant part at the end. See attached screenshot.
>

We could make it bigger. But it won't auto-adjust, meaning there'll
always be someone bugged by this.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com

pgadmin-hackers by date:

Previous
From: Erwin Brandstetter
Date:
Subject: Database bar
Next
From: Erwin Brandstetter
Date:
Subject: Re: Database bar