News for hackers. Stuff that matters.
Re:Postgres WASM by burggraf on Monday October 03, 2022 @10:59AM (#33068397)
Supabase developer here.

I've used this to move data from a live Supabase database down to the browser for testing and playing around with things in a "sandbox" environment. Then I save snapshots along the way in case I mess things up.

To move a table over from my Supabase-hosted postgres instance to the browser, I just exit out of psql and run something like this:

pg_dump --clean --if-exists --quote-all-identifiers -t my_table -h db.xxxxx.supabase.co -U postgres | psql -U postgres

Keep in mind if you try something like this, our proxy is rate limited for now to prevent abuse, so it might not be super fast. It's easy to remove rate limiting at the proxy, though.

Re:Postgres WASM by alex_duf on Monday October 03, 2022 @11:15AM (#33068661)
Correct me if I'm wrong, but given your profile (I assume someone in the tech world), nothing stopping you from doing all of the above with a local pg. If installing is annoying you could run it in docker.
Re:Postgres WASM by burggraf on Monday October 03, 2022 @11:35AM (#33069002)
You're absolutely right, you can use a local pg. This just makes it easier for me, as it's sort of a "sandbox" environment and I can easily take snapshots to do A/B testing or roll things back. I can also send a snapshot to a coworker so they can get my entire environment with all my data in a few seconds.
Re:Postgres WASM by vbezhenar on Tuesday October 04, 2022 @10:43AM (#33081097)
You can do that with docker unless you’re running ARM and your friend uses x86
Re:Postgres WASM by aaronax on Monday October 03, 2022 @02:16PM (#33071477)
People really do want to make the browser be the new OS.
Re:Postgres WASM by TheRealPomax on Monday October 03, 2022 @12:47PM (#33070075)
But now instead of the annoyance of installing pg, you have the annoyance of installing docker. and then writing a dockerfile. And then bootstrapping docker. etc. etc. =)
Re:Postgres WASM by Too on Monday October 03, 2022 @11:49PM (#33076538)
Who, working with these things regularly, does not have docker installed?

There is already an official image available so you don’t need to write dockerfile yourself. Having an instance up and running is literally just a docker run command away.

Re:Postgres WASM by nicoburns on Monday October 03, 2022 @06:22PM (#33074507)
Installing pg is hardly annoying. `brew install postgres`. Done.
Re:Postgres WASM by TheRealPomax on Monday October 03, 2022 @06:35PM (#33074611)
Replied to the wrong person, but I'll take that bait anyway: "Ahahahaha, no".

That only works if you live a blissful "all my hosted pg instances use the exact same version" world, which I've never seen be the case for even moderately sized projects. You're going to need multiple Postgres installs if you're going to need pg_dump/pg_restore, which you probably are.

(How you solve that problem, of course, is not a one-size-fits-all, and Docker may be the answer... or it may not)

Re:Postgres WASM by nicoburns on Monday October 03, 2022 @07:11PM (#33074900)
Doesn’t pg_dump/pg_restore work across versions? (So long as the CLI tools are the latest version). I guess version compatibility could be an issue in theory, but I’m yet to hit into a backwards compatibility issue with Postgres.
Re:Postgres WASM by TheRealPomax on Monday October 03, 2022 @09:58PM (#33075997)
I wish. You'd think it'd just be able to check the db to see if there's any schema or procedure incompatibility, but it doesn't. Instead, it goes "Remote uses version X and you're using version Y, sort that out" and then it exits.
Re:Postgres WASM by nicoburns on Tuesday October 04, 2022 @06:24AM (#33078437)
Oh, that's incredibly unhelpful!
Re:Postgres WASM by tracker1 on Monday October 03, 2022 @07:42PM (#33075103)
Generally use docker myself for this... pg + pgadmin + volume.. spin up when needed, down when not. Works pretty well.. I can see this being useful too though.