RE: RE: VARCHAR to CIDR type cast
От | Nicolas Huillard |
---|---|
Тема | RE: RE: VARCHAR to CIDR type cast |
Дата | |
Msg-id | 01C0F2A9.39CCECE0.nhuillard@ghs.fr обсуждение исходный текст |
Ответ на | VARCHAR to CIDR type cast (Nicolas Huillard <nhuillard@ghs.fr>) |
Ответы |
RE: RE: VARCHAR to CIDR type cast
|
Список | pgsql-general |
> -----Message d'origine----- > De: Alex Pilosov [SMTP:alex@pilosoft.com] > Date: vendredi 8 juin 2001 19:59 > À: Nicolas Huillard > Cc: 'pgsql-general@postgresql.org' > Objet: Re: [GENERAL] RE: VARCHAR to CIDR type cast > ... > > However, you say that you have a varchar in database already. As strange > as it may be, there isn't a cast function from any char type to any > network type. I'm sure its an oversight, its not hard to write such a > function based on inet_in.... That's what I'm planning... But I have not such function code to start with. Is there somewhere something like that : * a simple C function with all the PostgreSQL stuff * that simply call a PG's internal function (that will be cidr_in and inet_in, for me) > > Unfortunately, you cannot use inet_in function to cast a varchar, since it > expects as input slightly different data (a null-terminated string), > while varchar is different (it has length info in beginning). I remember > there was a discussion about creation of a 'cstring' datatype to support > such conversions (ie convert xxx to yyy via xxx_out and yyy_in), but I > don't see any result...Anyone? OK : the external cast function will only convert the "length-info-at-the-beginning" string into a "null-terminated" string, then call cidr_in... Really simple, in fact, but with a lot of stuff all around, isn't it ? NH
В списке pgsql-general по дате отправления: