Live data from Hacker News

Features I wish PostgreSQL had as a developer

bytebase.com

21–30 of 65 posts

Re: Features I wish PostgreSQL had as a developer

#22
I wish it had logical locks where you didn’t need to lock a particular row. Instead you’d just specify a string and lock on it and then execute your application code. Would be useful for distributed locks, or for transactions that may conflict with another so you take the logical lock in the application code before proceeding.

Re: Features I wish PostgreSQL had as a developer

#23

I wish it had logical locks where you didn’t need to lock a particular row. Instead you’d just specify a string and lock on it and then execute your application code. Would be useful for distributed locks, or for transactions that may conflict with another so you take the logical lock in the application code before proceeding.

Your wish was granted

https://www.postgresql.org/docs/current/explicit-locking.htm...

Re: Features I wish PostgreSQL had as a developer

#24

I wish it had logical locks where you didn’t need to lock a particular row. Instead you’d just specify a string and lock on it and then execute your application code. Would be useful for distributed locks, or for transactions that may conflict with another so you take the logical lock in the application code before proceeding.

[deleted]

Re: Features I wish PostgreSQL had as a developer

#25
post #18

I'd like to have a way of disabling certain (legacy?) functionality. They even list some of it on their wiki [1]. Maybe we could even get speedups by not covering the legacy cases. A plan to phase out some of these legacy features would be even better. Don't know if they do this in general. [1]: https://wiki.postgresql.org/wiki/Don't_Do_This

This comment should be at the top. That list is pretty much the first thing I add to the Readme.md of any new project (that uses Postgresql).

Re: Features I wish PostgreSQL had as a developer

#26
post #18

I'd like to have a way of disabling certain (legacy?) functionality. They even list some of it on their wiki [1]. Maybe we could even get speedups by not covering the legacy cases. A plan to phase out some of these legacy features would be even better. Don't know if they do this in general. [1]: https://wiki.postgresql.org/wiki/Don't_Do_This

WDYT about a "don't do this" feature that INFO/WARN/ERROR you when you try to use a given feature?

Re: Features I wish PostgreSQL had as a developer

#27
post #23

I wish it had logical locks where you didn’t need to lock a particular row. Instead you’d just specify a string and lock on it and then execute your application code. Would be useful for distributed locks, or for transactions that may conflict with another so you take the logical lock in the application code before proceeding.

Your wish was granted https://www.postgresql.org/docs/current/explicit-locking.htm...

That is the way, but the UX is pretty ass because the lock ID is a 64 bit number instead of a string. How the heck are you supposed to keep track of what lock ID you should be checking in a given situation across multiple client apps?

Re: Features I wish PostgreSQL had as a developer

#28
post #23

I wish it had logical locks where you didn’t need to lock a particular row. Instead you’d just specify a string and lock on it and then execute your application code. Would be useful for distributed locks, or for transactions that may conflict with another so you take the logical lock in the application code before proceeding.

Your wish was granted https://www.postgresql.org/docs/current/explicit-locking.htm...

It's not exactly string-based as it accepts bigint key, but I guess it's possible to hash a string when you pass it to the function.

Re: Features I wish PostgreSQL had as a developer

#29
post #28
post #23

Earlier quoted context omitted.

Your wish was granted https://www.postgresql.org/docs/current/explicit-locking.htm...

It's not exactly string-based as it accepts bigint key, but I guess it's possible to hash a string when you pass it to the function.

That's what exactly what I did a fairly basic distributed cron and it worked fine.
Post reply on HN