Forum OpenACS Q&A: Response to Postgres smart sort order for book titles...

I had to do this for my own site so here is my code:
create function title_sort_string(varchar) returns varchar as ' set word_list [split $1 { }] if { [lsearch -exact [list a an the] [string tolower [lindex $word_list 0]]] >= 0 } { set word_list [lreplace $word_list 0 0] } return [join $word_list { }] ' language 'pltcl';
then you can do select * from books order by title_sort_string(title)

Of course this is pretty simplistic, but it suits my needs. If you want to see some real rules for sorting publication titles, see this.