News for hackers. Stuff that matters.
Re:Learn Postgres at the Playground – Postgres compiled to W... by sigstoat on Wednesday August 17, 2022 @12:49PM (#32498719)
> This is so awesome for two reasons, Postgress isn't exactly easy to setup

for tutorial level usage, "apt-get install postgresql-X" or installing Postgres.app has always worked perfectly. what sort of troubles do you run into?

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!
Re:Learn Postgres at the Playground – Postgres compiled to W... by NeutralForest on Wednesday August 17, 2022 @01:52PM (#32499554)
Honestly not my experience, if you have postgresql running locally on your laptop, I find upgrading versions is a pain, even with the automated scripts provided and I often run in socket issues: psql is already connected, not able to connect to this or that socket,...

So yeah, installing is easy and on a clean install it runs fine but it's not unusual to get pretty annoying issues over time in my experience.

Re:Learn Postgres at the Playground – Postgres compiled to W... by mike_hearn on Wednesday August 17, 2022 @04:20PM (#32501206)
But presumably none of those issues is fixed by using WASM in a browser.
Re:Learn Postgres at the Playground – Postgres compiled to W... by NeutralForest on Thursday August 18, 2022 @02:48AM (#32506150)
They aren't but they probably won't appear user-side, the companies will most likely have to deal with their servers, fix those issues and the users can enjoy not thinking about that when they're trying PostgreSQL online.
Re:Learn Postgres at the Playground – Postgres compiled to W... by zachrose on Wednesday August 17, 2022 @01:01PM (#32498905)
Imagine wanting to learn Postgres but not knowing how to use a package manager, for example
Re:Learn Postgres at the Playground – Postgres compiled to W... by konart on Wednesday August 17, 2022 @01:35PM (#32499357)
Is this even a possibility?
Re:Learn Postgres at the Playground – Postgres compiled to W... by afavour on Wednesday August 17, 2022 @01:40PM (#32499430)
1000%. Lots of people want to do data analysis, learn SQL, all that kind of stuff, without having to learn a load of other unrelated development crap. Think of all the people out there using Excel who want to take the next step.
Re:Learn Postgres at the Playground – Postgres compiled to W... by l2k34j1l2k34jj1 on Wednesday August 17, 2022 @10:01PM (#32504323)
After browsing this site for a couple of years, I made an account to reply to your comment and say, "This is exactly right" lol. I'm a teacher who uses Excel for basic stuff (power query, pivot tables), but I'm also using Excel as a "database", which is obviously not a good idea.

So here I am trying to take the next step and learn SQL along with good database design, but learning these things through Postgres is really not appropriate for someone like me. I think I have to swallow my pride and start with Access or something.

Re:Learn Postgres at the Playground – Postgres compiled to W... by konart on Thursday August 18, 2022 @12:11AM (#32505173)
You may want to try https://dbeaver.io/ + SQLLight for the start.

You just download binary for your OS, create a db as described here (https://www.sqlite.org/quickstart.html) and then connect to it with dbeaver.

This is more the enough to get familiar with SQL.

Re:Learn Postgres at the Playground – Postgres compiled to W... by afavour on Thursday August 18, 2022 @09:44AM (#32509475)
No shame in using Access! It's actually part of how I got my start in tech. Started with an Access database, started writing macros for it in VBA, then started writing VB.NET, then convinced a higher up to give me access to a SQL Server database.

I was in an industry with an absurd number of boilerplate forms that needed to be printed and the ability to create Access forms that automated all the manual filling out coworkers were doing felt like magic. Postgres doesn't really have an equivalent of that.

Re:Learn Postgres at the Playground – Postgres compiled to W... by simonw on Wednesday August 17, 2022 @02:40PM (#32500075)
Yes. See this survey on Twitter from the other day - LOADS of "React" developers (aka front-end developers) are deterred from learning more about backend programming due to friction like this. https://twitter.com/rachelnabors/status/1558888478955421697
Re:Learn Postgres at the Playground – Postgres compiled to W... by konart on Wednesday August 17, 2022 @03:27PM (#32500642)
I still kind of lost here.

I know this much about frontend development too but I was sure that you still need a package manager to install your npm\yarn and other tools.

PS: Obviously you can live without one. Regardless of being backend\frontend developer.

PPS: and honestly, how can you be scared of postgresql and co. after webpack? If you can actually understand this crap postgres setup should be to easy for you.

Re:Learn Postgres at the Playground – Postgres compiled to W... by simonw on Wednesday August 17, 2022 @05:31PM (#32501978)
Yeah I personally find Webpack a whole lot scarier than PostgreSQL / package managers, but that's down to my previous career experience.

Really the key thing here is that learning new things is hard, and anything that can be done to remove potential roadblocks is worthwhile. I've talked to so many people who were put off learning Python because they couldn't get to a working development environment on their own.

Re:Learn Postgres at the Playground – Postgres compiled to W... by josephg on Wednesday August 17, 2022 @03:30PM (#32500690)
> If you can actually understand this crap postgres setup should be to easy for you.

You can figure almost anything out if you spend enough time reading documentation and noodling with it. I'd still rather spend that time solving my actual problem.

Re:Learn Postgres at the Playground – Postgres compiled to W... by powerhour on Wednesday August 17, 2022 @05:41PM (#32502075)
You don't really need webpack or etc for this, you can just hit some page that hosts the wasm already.
Re:Learn Postgres at the Playground – Postgres compiled to W... by konart on Thursday August 18, 2022 @03:41AM (#32506522)
Just to be clear: I was not talking about the project at crunchydata.com. I merely say that in my opinion modern js development routine is much more complicated that postgres setup
Re:Learn Postgres at the Playground – Postgres compiled to W... by groffee on Wednesday August 17, 2022 @03:12PM (#32500446)
LOADS of React "developers"
Re:Learn Postgres at the Playground – Postgres compiled to W... by trissylegs on Wednesday August 17, 2022 @10:26PM (#32504496)
People who come from Windows + MSSQL world might not have touched a package manager before and want to try out Postgres.