From: Victoria Stuart (VictoriasJourney.com) <mail@VictoriasJourney.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Cc: mail@VictoriasJourney.com
Subject: Re: Nvim as external editor in psql as Postgres root user - .vimrc (environment?) issue
Date: Fri, 16 Mar 2018 14:17:07 -0700
Message-ID: <20180316141707.1764d238@VictoriasJourney.com> (raw)
In-Reply-To: <155e58d8-6fde-727c-4569-d4f23468c592@aklaver.com>
References: <20180316104746.1e23e682@gmail.com>
<423630eb-637d-8158-3325-ee036910b2c6@aklaver.com>
<20180316110517.221f9c7f@gmail.com>
<20180316130654.650599b5@gmail.com>
<155e58d8-6fde-727c-4569-d4f23468c592@aklaver.com>
@Adrian: Good point!! ;-)
When I re-installed postgres some months ago, I basically followed
https://wiki.archlinux.org/index.php/PostgreSQLhttps://serverfault.com/questions/601140/whats-the-difference-between-sudo-su-postgres-and-sudo-u-po...
HOWEVER, as you note/allude, I tried this:
[victoria@victoria ~]$ pwd
/home/victoria
[victoria@victoria ~]$ createuser -s -U postgres --interactive
Enter name of role to add: victoria
createuser: creation of new role failed: ERROR: role "victoria" already exists
[victoria@victoria ~]$ createdb metab_test
createdb: database creation failed: ERROR: database "metab_test" already exists
[victoria@victoria ~]$ dropdb metab_test
[victoria@victoria ~]$ createdb metab_test
[victoria@victoria ~]$ psql -d metab_test -U victoria
psql (10.2)
Type "help" for help.
[metab_test]# \l
List of databases
┌─────────────┬───────────┬──────────┬─────────────┬─────────────┬───────────────────────┐
│ Name │ Owner │ Encoding │ Collate │ Ctype │ Access privileges │
├─────────────┼───────────┼──────────┼─────────────┼─────────────┼───────────────────────┤
│ metab │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ │
│ metab_test │ victoria │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ │
│ metabolicdb │ metabolic │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ │
│ postgres │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ │
│ template0 │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ =c/postgres ↵│
│ │ │ │ │ │ postgres=CTc/postgres │
│ template1 │ postgres │ UTF8 │ en_US.UTF-8 │ en_US.UTF-8 │ =c/postgres ↵│
│ │ │ │ │ │ postgres=CTc/postgres │
└─────────────┴───────────┴──────────┴─────────────┴─────────────┴───────────────────────┘
[metab_test]# \c metab
You are now connected to database "metab" as user "victoria".
[metab]# \d
List of relations
┌────────┬───────────────────────────────┬──────────┬──────────┐
│ Schema │ Name │ Type │ Owner │
├────────┼───────────────────────────────┼──────────┼──────────┤
│ public │ bioent │ table │ postgres │
│ public │ bioent_id_seq │ sequence │ postgres │
│ public │ enzyme_synonyms │ table │ postgres │
│ public │ enzyme_synonyms_id_seq │ sequence │ postgres │
│ public │ glycolysis_enzymes │ table │ postgres │
│ public │ glycolysis_enzymes_id_seq │ sequence │ postgres │
│ public │ glycolysis_metabolites │ table │ postgres │
│ public │ glycolysis_metabolites_id_seq │ sequence │ postgres │
│ public │ metabolite_synonyms │ table │ postgres │
│ public │ metabolite_synonyms_id_seq │ sequence │ postgres │
│ public │ metabolites │ table │ victoria │
│ public │ metabolites_id_seq │ sequence │ victoria │
│ public │ relations │ table │ postgres │
│ public │ relations_id_seq │ sequence │ postgres │
└────────┴───────────────────────────────┴──────────┴──────────┘
[metab]# \e ## launches external editor (neovim), c. victoria's settings ...
[metab]# \q
[victoria@victoria ~]$
Of course (in Arch Linux), the postgres service enabled and running:
sudo systemctl enable postgresql
sudo systemctl enable postgresql
Thank you very much for your comment; this greatly simplifies things!
I guess I just needed a nudge in that direction.
Much appreciated! :-D
==============================================================================
----- Original Message(s): -----
Date: 2018 Mar 16 (Fri) 13:33
From: Adrian ...
Subject: Re: Nvim as external editor in psql as Postgres root user - .vimrc (environment?) issue
On 03/16/2018 01:06 PM, Victoria wrote:
> Ok, here is a clumsy solution.
Still not sure why you want to run as the system postgres user. The
system user postgres is not the same as the Postgres database user
postgres. It is just convention that the system user that Postgres runs
as is called postgres. If you want to work in Postgres as the database
user postgres you just need to supply -U postgres to the client(psql in
this case). You can do that from your home account(victoria) without all
the contortions below:)
[snip: my previous post / "solution"]
--
Adrian Klaver
adrian.klaver@aklaver.com
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: mail@VictoriasJourney.com
Subject: Re: Nvim as external editor in psql as Postgres root user - .vimrc (environment?) issue
In-Reply-To: <20180316141707.1764d238@VictoriasJourney.com>
References: <20180316104746.1e23e682@gmail.com> <423630eb-637d-8158-3325-ee036910b2c6@aklaver.com> <20180316110517.221f9c7f@gmail.com> <20180316130654.650599b5@gmail.com> <155e58d8-6fde-727c-4569-d4f23468c592@aklaver.com> <20180316141707.1764d238@VictoriasJourney.com>
* 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