There is a problem with this, though; the postcode data is not free, but is owned by Royal Mail, who monetise the hell out of it. If you wish to use the database for your own purposes, doing so will cost you a few thousand pounds a year. (The fact that your taxes may have paid for the system to be drawn up doesn't enter into the argument.)
Anyway, this has gotten up the nose of a number of open-geodata activists, who are doing something about it: they're collecting their own data mapping points to postcodes, and using this to draw up freely usable and distributable maps of postcode areas. Free The Postcode! is aiming to do this at a high level of accuracy, soliciting input from people with GPS receivers; meanwhile, New Popular Edition Maps is using a 1940s-vintage map of England and Wales (Scotland and Northern Ireland may come later) to allow people to click on where their homes are and enter the postcodes. Since this is inherently less accurate (the map is of fairly low resolution, and the process depends on matching shapes of streets), they're only concerned with the prefixes at this stage. The data produced will be released into the public domain.
Please keep comments on topic and to the point. Inappropriate comments may be deleted.
Note that markup is stripped from comments; URLs will be automatically converted into links.