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

Jan 25 2007

A Basic Introduction to Postgres Stored Procedures

Jamie Begin

This article introduces the very basics of writing stored procedures with PostgreSQL (aka Postgres), an open-source database system. It is intended for both Postgres newbies and MS SQL Server/MySQL stored procedure veterans who are interested learning more about Postgres. Introduction I originally come from the world of MS SQL Server where stored p …

Read more