This question appeared couple of times on irc, so I figured I can do a blogpost about it.

On 5th of February, Tom Lane committed patch: Add num_nulls() and num_nonnulls() to count NULL arguments. An example use-case is "CHECK(num_nonnulls(a,b,c) = 1)" to assert that exactly one of a,b,c isn't NULL. The functions are variadic, so they can also be pressed into ...

Some people are afraid of triggers. Reasons for this are not really understandable for me, but I guess it stems from the fact that these are usually application developers, and not database admins. Or they encountered some kind of problem with ...

Some time ago I wrote about getting fast pagination. While fast, it had some problems which made it unusable for some. Specifically - you couldn't get page count, and easily jump to page number N. I did some thinking on the ...

I got asked this: having this table: # select * from a order by d; t | d ---+---- O | 1 O | 2 O | 3 M | 4 M | 5 M ...

Let's assume you have very simple table with users: # \d users Table "public.users" ...

When I was working for one of customers we found some strange thing. We needed to found number of distinct sessions per day. Table layout was very simple: