Mar 22 2012

A better way to authenticate users via a SQL database.

Jamie Begin

For years I’ve been using this simple design pattern when building a new user authentication backend for a project. Rather than just querying whether a username and password is valid, I perform a conditional INSERT on a login history table. It’s a pretty obvious idea, but not one that I’ve personally encountered in other developer …

Read more

Mar 4 2010

Rounding datetimes and timestamps in PostgreSQL

Jamie Begin

A simple PL/pgSQL function to round either a datetime or timestamp value to the nearest N seconds. …

Read more

Mar 2 2010

Base36 Conversion in PostgreSQL

Jamie Begin

Using PostgreSQL to base36 encode (and decode) large integers for better human readability. Base36 encoding intermixes letters and digits and is most frequently encountered with URL shortening services and on Dell service tags. …

Read more