|
|
PGTS Blog ArchiveThread: Tips/Tricks For Programming etc |
|
Gerry Patterson. The world's most humble blogger | |
Edited and endorsed by PGTS, Home of the world's most humble blogger | |
| |
Postgres and Network Address Types |
|
Chronogical Blog Entries:
|
|
| |
Date: Mon, 24 Jan 2005 10:31:17 +1100 When I first started using postgres, I was already an experienced Oracle
user. I found myself typing things like:
|
I even created a table called "dual" in order to overcome this. Of course since then I have learned to do things the postgres way.
One very useful feature in postgres is the Network Address Types. Unfortunately, I did not discover them until I had written a swag of software. Most of this was for the agent tracking system and it employs varchar data types for IP addresses. It was only later when I was writing perl routines to relate/extract CIDRs and IP addresses, that I discovered these very useful data types.
When I first started using postgres (to develop this website), I had used the manuals only as a reference guide, dipping into it when I had a question about the way that postgres worked. Later, the discovery of network address types caused me to regret that I hadn't spent the time to read all the documentation more thoroughly when I first installed it.
So a word of advice for those of you who are new to postgres, or contemplating using it. If you are dealing with addresses, CIDRs or mac addresses, read the section on network address types now!. It could save you a lot of work, and add a very powerful feature to your software toolbox.
Of course, now I am faced with the problem of how to upgrade the existing system that uses varchar types to store IP addresses. Just another little project that I have to do when I have the time.