From: | Nicolas Huillard <nhuillard(at)ghs(dot)fr> |
---|---|
To: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: VARCHAR to CIDR type cast |
Date: | 2001-06-08 10:18:46 |
Message-ID: | 01C0F015.2B4CB240.nhuillard@ghs.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
So, nobody (even hackers) know how to work around this ?
Or this problem is solved in 7.x, and nobody wants to bother with 6.5.3 ?
Or the question was so complicated that nobody understood it ?
Sorry to insist, but I really don't want to modify my DB structure (there
are implications far away from Postgres, because the DB is replicated with
many Access DB's, etc)
NH
> -----Message d'origine-----
> De: Nicolas Huillard [SMTP:nhuillard(at)ghs(dot)fr]
> Date: mercredi 6 juin 2001 12:55
> À: 'pgsql-general(at)postgresql(dot)org'
> Objet: VARCHAR to CIDR type cast
>
> Hello,
>
> I use Postgres 6.5.3.
> The following query doesn't work :
>
> nhuillard=> SELECT login FROM vue_auth WHERE (login ~ '^[0-9./]+$') AND
(login::cidr >> '192.168.200.109'::inet);
> ERROR: No such function 'cidr' with the specified attributes
>
> This query look for login (varchar) that look like IP network adresses
(cidr), then check if the provided IP adresses is within this network.
>
> The only cidr function that exist in the catalog is "cidr_in" :
>
> nhuillard=> SELECT t.typname as result, p.proname as function,
substr(oid8types(p.proargtypes),1,14) as arguments,
substr(obj_description(p.oid),1,34) as description FROM pg_proc p, pg_type
t WHERE (p.prorettype = t.oid) and (t.typname = 'cidr') ORDER BY result,
function, arguments;
> result|function|arguments|description
> ------+--------+---------+-----------
> cidr |cidr_in | |(internal)
> (1 row)
>
> This function seems to be the input function, but can't be used for
casting... Is there a way to use it for casting varchar to cidr, or
something else ?
> I tried the following :
>
> nhuillard=> create function cidr(text) returns cidr as 'cidr_in' language
'internal';
> CREATE
> nhuillard=> SELECT login FROM vue_auth WHERE (login ~ '^[0-9./]+$') AND
(login::cidr >> '192.168.200.109'::inet);
> ERROR: could not parse "s"
>
> Any advice ?
>
> Nicolas Huillard
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathan Bartlett | 2001-06-08 10:50:51 | RE: PostgreSQL 7.1 and ORACLE 8.x |
Previous Message | Bonnie | 2001-06-08 09:02:51 | Errors in log file |