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

Re: Postresql: need a way to initiate a database with a test user



On Fri, Sep 15, 2017 at 01:03:36PM +0000, Tom Browder wrote:
> I get the following error when trying to create a table with psql:
> 
>   psql:  FATAL:   Peer authentication failed for user "sql92"
>   The spawned command 'psql -f ./t/t.sql -U sql92' exited unsuccessfully
> (exit code: 2)
> 
> The sql file has two create table commands.
> 
> I had already created the user 'sql92' with password = '' and createdb
> privileges.
> 
> Is there any way to create a user that can be used outside an open database
> connection in a script?

If you want something "just for testing", you can spin up a pg
instance on demand - custom access port and other params (so you
don't clash with any existing instance/install) - this is running it
like e.g. MSAccess "as an application", although "true db admins"
will of course highlight that this is very inefficient and pg is
designed to readily run any number of databases you might need ... in
the single running instance.

Haven't used it for years, so other than that ... Good luck :)


Reply to: