PostgreSQL’s table functions are a pretty handy feature:
Table functions are functions that produce a set of rows, made up of either base (scalar) data types, or composite (multi-column) data types. They are used like a table, view, or subselect in the FROM clause of a query. Columns returned by table functions may be included in SELECT, JOIN, or WHERE clauses in the same manner as a table, view, or subselect column.
Especially when combined with the embedded procedural languages one can fold a lot of external functionality into typical SQL idioms. Of course I’m sort of partial to the fact that PostgreSQL supports Python as a procedural language straight out of the box.