Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to insert an IP-address into a column that has type inet. In what format can I insert the data? is it only binary or is there any way I can insert from text e.g. ""? Are there any help-functions for this so I can test it from psql in the command prompt?

share|improve this question
up vote 9 down vote accepted

It seems pretty easy:

postgres=# create table inet_test (address inet);


postgres=# insert into inet_test values ('');


postgres=# insert into inet_test values ('');


postgres=# select * from inet_test;

(2 rows)
share|improve this answer
Ah, thanks, I only tried with "". – Jonas Jun 1 '11 at 11:04
Cast your text value to ::INET. ''::INET should be sufficient. – Sean Jun 1 '11 at 19:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.