-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: missing username in connection URL prevents username from appearing in prompt #10863
Comments
I don't think the username field will be empty. lib/pq uses the username provided by the operating system if none is provided through the URL. I tested it out and my os username is correctly used. After #10862 (thanks for catching that btw) the only issue I see is that the username used for the connection won't be reflected in the prompt. |
Oh thanks for your analysis. Then the cli shell should do what is already done for other things and fetch the current user from the database. Changed the issue description accordingly. |
@knz, I want to have a try for this. |
@a6802739 ok, thanks! |
@knz, what does the |
(the username is missing) |
@knz, thanks for your reference. |
Good evening @knz may i give this is issue a go myself ? Best regards, |
yes you can also have a look. |
@pmamatsis note we have already a PR out for this in #12408. You can help with reviewing it though. |
Good evening @knz, I wanted to ask you a newbie question about the rebase. When i am checking into master (i have added the official repository of cockroachdb as 'main') and perform the
If i execute the command
Best regards, |
Can you show me the content of your `.git/config`
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Good afternoon @knz,
I have checked the pkg/cli/sql.go file that i have locally against the one in the official cockroachdb repo and they are identical though. Best regards and thank you in advance, |
Ok then, it's easy: the message merely indicates that your |
Good evening @knz, Best regards, |
Looks like this was fixed by #12408 Closing! |
If COCKROACH_URL or
--url
specifies no username with an insecure cluster, the connection is accepted and the underlying pq library uses the name of the user who launched the shell. However the CLI shell's prompt does not see this and the username part appears empty in the prompt.A better behavior would be to query the database after the connection is established to determine what the current user is, much like the CLI already queries the database for syntax/txn status.
Found while investigating #10835.
The text was updated successfully, but these errors were encountered: