mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
Add Who Is The Current User as a postgres til.
This commit is contained in:
@@ -56,6 +56,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
- [Timestamp Functions](postgres/timestamp-functions.md)
|
||||
- [Toggling The Pager In PSQL](postgres/toggling-the-pager-in-psql.md)
|
||||
- [Turning Timing On](postgres/turning-timing-on.md)
|
||||
- [Who Is The Current User](postgres/who-is-the-current-user.md)
|
||||
- [Word Count for a Column](postgres/word-count-for-a-column.md)
|
||||
|
||||
### rails
|
||||
|
||||
21
postgres/who-is-the-current-user.md
Normal file
21
postgres/who-is-the-current-user.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Who Is The Current User
|
||||
|
||||
You can determine the current user of a psql session by selecting on the `current_user`
|
||||
|
||||
```sql
|
||||
> select current_user;
|
||||
|
||||
current_user
|
||||
----------------
|
||||
test_user
|
||||
```
|
||||
|
||||
You can also select on the `user` which is an alias of `current_user`
|
||||
|
||||
```sql
|
||||
> select user;
|
||||
|
||||
user
|
||||
----------------
|
||||
test_user
|
||||
```
|
||||
Reference in New Issue
Block a user