From bbe2f897eb2e1aa94378cca6fbc66387d0373ab8 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 7 Jun 2015 21:03:02 -0500 Subject: [PATCH] Add Who Is The Current User as a postgres til. --- README.md | 1 + postgres/who-is-the-current-user.md | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 postgres/who-is-the-current-user.md diff --git a/README.md b/README.md index 4d69a21..b925947 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/postgres/who-is-the-current-user.md b/postgres/who-is-the-current-user.md new file mode 100644 index 0000000..47ad3cb --- /dev/null +++ b/postgres/who-is-the-current-user.md @@ -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 +```