My take on trees in SQL

Quick note in polish: jeśli znasz moje poprzednie posty nt. drzew, to ten możesz sobie pewnie odpuścić. będzie zawierał jedynie opis implementacji zbliżony do tego co już jest dostępne.

OK, back to English (or at least my version of English).

Finding a good way to store trees in SQL was/is my long-term hobby. I tried ltree, basic adjacency list, Celko's nested sets way, and nothing really was able to make me feel satisfied.

Ltree is great, but PostgreSQL only (not that it's a big problem). Adjacency list is very simple in insert, update and delete operations, but forces me to use recursive queries in case of some not-so-standard queries. Nested sets are quite the contrary – great for selects, but I simply hate writing insert/update/delete to these trees.

Is there anything better? I think so.

Continue reading My take on trees in SQL

keyboard shortcuts in psql

there is this quite old, but pretty functional concept: keyboard shortcuts.

you know it – you press ctrl-s, and your editor saves currently-edited file.

my problem is that there are some standard cases when i would really love to have this ability in psql. but psql doesn't support it. or does it?

Continue reading keyboard shortcuts in psql