tags:

views:

40

answers:

1

Is there an easy way to convert an int to an IP address in PostgreSQL? I was able to go from IP to int using this code:

SELECT inet '1.2.3.4'-'0.0.0.0'

This doesn't work:

SELECT 16909060::inet

I didn't see anything in the documentation. Does anyone know how to do this?

+3  A: 
SELECT '0.0.0.0'::inet + 16909060
Quassnoi
That seemed to work for me.
User1