News for hackers. Stuff that matters.
Re:Learn Postgres at the Playground – Postgres compiled to W... by simonw on Wednesday August 17, 2022 @02:38PM (#32500056)
I run into problems with the next steps: now you have to create a database, create a user, grant that user access to the database, setup credentials and start using them.

This isn't impossible - I can do it if I consult my notes - but it has enough steps where something might go wrong that it's a pretty high friction process for newcomers.

Re:Learn Postgres at the Playground – Postgres compiled to W... by Starlevel001 on Wednesday August 17, 2022 @04:36PM (#32501378)
> now you have to create a database, create a user, grant that user access to the database, setup credentials and start using them.

CREATE ROLE dumbo WITH LOGIN PASSWORD 'fuck';

CREATE DATABASE dumbo OWNER dumbo;

It's that easy.

Re:Learn Postgres at the Playground – Postgres compiled to W... by stuaxo on Wednesday August 17, 2022 @05:02PM (#32501686)
I only have to run these about once every year or two, and have to look them up every time.
Re:Learn Postgres at the Playground – Postgres compiled to W... by rattray on Wednesday August 17, 2022 @04:51PM (#32501532)
Many developers don't run those commands very frequently, so they're easy to forget.
Re:Learn Postgres at the Playground – Postgres compiled to W... by Diggsey on Wednesday August 17, 2022 @07:21PM (#32503094)
You can do all this pretty easily using `pgAdmin` without having to remember any commands. If you do this infrequently, then great use the GUI. If you do it frequently then learn the commands I guess :P `pgAdmin` can help with that too though as it usually shows you the queries it is running.
Re:Learn Postgres at the Playground – Postgres compiled to W... by groffee on Wednesday August 17, 2022 @03:09PM (#32500415)
> I run into problems with the next steps: now you have to create a database, create a user, grant that user access to the database, setup credentials and start using them.

That's like complaining you need to break eggs when you want to make an omelette.

Re:Learn Postgres at the Playground – Postgres compiled to W... by michaelmior on Wednesday August 17, 2022 @03:44PM (#32500838)
> That's like complaining you need to break eggs when you want to make an omelette.

I have a friend who we discovered didn't like cooking eggs because picking the shells out of the bowl was tedious. Turns out he was never taught how to crack an egg so he would just throw it in the bowl and have bits of shell everywhere. Point is that breaking eggs may not be so easy for everyone. (Of course, after describing to him how eggs are properly cracked, he was excited to try it out.)

Re:Learn Postgres at the Playground – Postgres compiled to W... by josephg on Wednesday August 17, 2022 @03:27PM (#32500643)
Being necessary and being exhausting aren't mutually exclusive qualities.

But - why are the steps needed to create a database and setup credentials such a complex, manual process anyway? Why can't all those steps just be automated by a helper script that ships with postgres?

I reach for sqlite whenever I introduce SQL to people because its so much easier to get started with sqlite.

Re:Learn Postgres at the Playground – Postgres compiled to W... by dotancohen on Wednesday August 17, 2022 @04:47PM (#32501487)
The reason that I reach for MySQL when introducing people to SQL is the formatted output, with nice tables and column names. Is there a simple way to get similar output with SQLite?
Re:Learn Postgres at the Playground – Postgres compiled to W... by josephg on Wednesday August 17, 2022 @05:21PM (#32501888)
Yep! Just set sqlite into table mode:

    sqlite> .mode table
    sqlite> select * from example;
    +-----+----------+
    | id  |   foo    |
    +-----+----------+
    | 123 | afsd     |
    +-----+----------+
SQLite also has CSV, JSON, HTML and markdown modes - which is pretty neat!
Re:Learn Postgres at the Playground – Postgres compiled to W... by dotancohen on Thursday August 18, 2022 @12:06AM (#32505137)
Thank you!