Let me know if this answer can helps you, I've set up next sample on dbfiddle.uk.
create table myt
(
id uuid NOT NULL,
ipAddresses inet[],
createdAt timestamp with time zone,
updatedAt timestamp with time zone
);
insert into myt values
('0e37df36-f698-11e6-8dd4-cb9ced3df976'::uuid, array['10.0.0/24','20.0.0.1']::inet[], now(), now()),
('0e37df36-f698-11e6-8dd4-cb9ced3df977'::uuid, array['10.0.0.2','20.0.0.2']::inet[], now(), now()),
('0e37df36-f698-11e6-8dd4-cb9ced3df978'::uuid, array['10.0.0.4','20.0.0.3']::inet[], now(), now()),
('0e37df36-f698-11e6-8dd4-cb9ced3df979'::uuid, array['10.0.0.4']::inet[], now(), now())
;
I'm not really good using arrays, neither on postgres, but as far as you are querying an array, you should use {} to compare elements of an array.
select *
from myt
where ipaddresses @> '{10.0.0.4}'
id | ipaddresses | createdat | updatedat
:----------------------------------- | :------------------ | :---------------------------- | :----------------------------
0e37df36-f698-11e6-8dd4-cb9ced3df978 | {10.0.0.4,20.0.0.3} | 2017-07-21 11:06:04.547226+01 | 2017-07-21 11:06:04.547226+01
0e37df36-f698-11e6-8dd4-cb9ced3df979 | {10.0.0.4} | 2017-07-21 11:06:04.547226+01 | 2017-07-21 11:06:04.547226+01
If you are looking if an ip range contains an specific IP, I think you should unnest array elements and then use >> operator.
select *
from (select id, unnest(ipaddresses) ip
from myt) t1
where t1.ip::inet >> '10.0.0.4'::inet
id | ip
:----------------------------------- | :----------
0e37df36-f698-11e6-8dd4-cb9ced3df976 | 10.0.0.0/24
Additionaly let me suggest you to have a look at ip4r module.
dbfiddle here