Search Postgresql Archives

Re: Nvim as external editor in psql as Postgres root user - .vimrc (environment?) issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



@Adrian:  Good point!!  ;-)

When I re-installed postgres some months ago, I basically followed

  https://wiki.archlinux.org/index.php/PostgreSQL  

  https://serverfault.com/questions/601140/whats-the-difference-between-sudo-su-postgres-and-sudo-u-postgres

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@xxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux