Entries Tagged as 'postgres'

Wednesday, January 2nd, 2008

Postgres select replace with regular expression

Postgres seriously kicks ass, here's a quick way to do a substring based on a regular expression. A Co-worker wanted to get the first word out of a column that contained a sentence. If we were using something lame like oracle we'd have to do gymnastics to do that. It's a one-liner in postgres. SELECT [...]

Wednesday, July 25th, 2007

Postgres Array Joins

Every once in a while you'll come across the need to create a temp table to perform a complicated select query. Not being a big fan of creating these temp tables, I came up with a better solution. Leveraging Postgresql's array structure, I wrote a function that converts a varchar[] to a record set. CREATE [...]

Monday, October 9th, 2006

Formatting Numbers in Oracle and Postgres

When dealing with large numbers in oracle sometimes it can be hard to read the results from a query with no formatting in the results. I know I have misread numbers from a query many times. Well, I finally got around to looking up how to format numbers in oracle. And who knew -- TO_CHAR [...]