Live data from Hacker News

A Language Server for Postgres

github.com

21–24 of 24 posts

Re: A Language Server for Postgres

#21

As someone who’s written a ton of PL/pgSQL code recently, I have been saving all my functions and their subsequent revisions in database migration files (Supabase). This feels like such a huge step backwards compared to browsing a well structured codebase with namespaces and modules. I know that Postgres provides schemas, and I am using them to a limited extent, but I am really speaking towards just having a tree ori…

Declarative tools/workflows solve this much more elegantly than imperative migration tools. There's some initial discussion in sibling comment thread here, although that isn't specific to procedures/functions. Regarding stored procs/funcs in particular and managing them like a codebase using a declarative tool, I have a blog post about this at https://www.skeema.io/blog/2023/10/24/stored-proc-deployment... – and alth…

Thank you!

Re: A Language Server for Postgres

#22
post #15

As someone who’s written a ton of PL/pgSQL code recently, I have been saving all my functions and their subsequent revisions in database migration files (Supabase). This feels like such a huge step backwards compared to browsing a well structured codebase with namespaces and modules. I know that Postgres provides schemas, and I am using them to a limited extent, but I am really speaking towards just having a tree ori…

Yeah, I’m in the midst of building out something for this. Involves a few pieces, the first is being able to apply the files in the right order https://github.com/joshainglis/topcat Essentially the output of that should be a file that should drop and recreate everything. Easy to build some automation around. And if you’re just operating on functions and views ect that should be all you need to allow a tree based code…

Will take a look, thank you!

Re: A Language Server for Postgres

#23
post #19

Earlier quoted context omitted.

https://github.com/t1mmen/srtd might help here. The general idea is to define functions/policies/etc as «SQL templates», your source of truth. The templates built into Supabase migrations. While developing, srtd can hot/live reload your templates into the local db when changed. I built this to scratch my own itch, and it’s been working VERY well for us. Huge DX benefits, and it’s made code reviews a LOT easier, since…

This looks pretty damn good. Thank you!

Just tried it out. This is exactly what I was looking for. Very nice work!

Re: A Language Server for Postgres

#24

Earlier quoted context omitted.

This looks pretty damn good. Thank you!

Just tried it out. This is exactly what I was looking for. Very nice work!

Thank you, I’m glad to hear it works well for others too!

If you come across issues or can think of anything that would improve it, please let me know :)

Post reply on HN