Inet type how to?
Inet type how to?
От:
Olivier PRENANT <ohp@pyrenet.fr>
Дата:
Hi all, I've had a table for years to keep radius connections to our NAS. Not havin inet type, I typed ip_adress as text. Now, I'em trying to change this column type to no avail. select inet(ip_addr)... : cannot cast type to inet How can I change this column?? TIA -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) Quartier d'Harraud Turrou +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: ohp@pyrenet.fr ------------------------------------------------------------------------------ Make your life a dream, make your dream a reality. (St Exupery)
Re: Inet type how to?
От:
Alex Pilosov <alex@pilosoft.com>
Дата:
You cannot change column type without dropping/recreating the table. On Fri, 2 Jun 2000, Olivier PRENANT wrote: > Hi all, > > I've had a table for years to keep radius connections to our NAS. > > Not havin inet type, I typed ip_adress as text. Now, I'em trying to change > this column type to no avail. > > select inet(ip_addr)... : cannot cast type to inet > > How can I change this column?? > > TIA > >
Re: Inet type how to?
От:
Olivier PRENANT <ohp@pyrenet.fr>
Дата:
Yes, I know that; but even when I reload it, copy complains it can't convert 194.250.190.185 ( for example) to inet! Regards On Fri, 2 Jun 2000, Alex Pilosov wrote: > You cannot change column type without dropping/recreating the table. > > On Fri, 2 Jun 2000, Olivier PRENANT wrote: > > > Hi all, > > > > I've had a table for years to keep radius connections to our NAS. > > > > Not havin inet type, I typed ip_adress as text. Now, I'em trying to change > > this column type to no avail. > > > > select inet(ip_addr)... : cannot cast type to inet > > > > How can I change this column?? > > > > TIA > > > > > -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) Quartier d'Harraud Turrou +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: ohp@pyrenet.fr ------------------------------------------------------------------------------ Make your life a dream, make your dream a reality. (St Exupery)
Re: Inet type how to?
От:
Alex Pilosov <alex@pilosoft.com>
Дата:
It works for me for \copy (which uses inserts) But yes, there is no way to convert text to inet, which is a pain. When it annoys me sufficiently, I think I'll write text_inet wrapping inet_in...Or just wait for someone else to do it (TODO, bruce? ;) On Fri, 2 Jun 2000, Olivier PRENANT wrote: > Yes, I know that; but even when I reload it, copy complains it can't > convert 194.250.190.185 ( for example) to inet! > > Regards > On Fri, 2 Jun 2000, Alex Pilosov wrote: > > > You cannot change column type without dropping/recreating the table. > > > > On Fri, 2 Jun 2000, Olivier PRENANT wrote: > > > > > Hi all, > > > > > > I've had a table for years to keep radius connections to our NAS. > > > > > > Not havin inet type, I typed ip_adress as text. Now, I'em trying to change > > > this column type to no avail. > > > > > > select inet(ip_addr)... : cannot cast type to inet > > > > > > How can I change this column?? > > > > > > TIA > > > > > > > > > >
Re: Inet type how to?
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
> It works for me for \copy (which uses inserts) > > But yes, there is no way to convert text to inet, which is a pain. When it > annoys me sufficiently, I think I'll write text_inet wrapping inet_in...Or > just wait for someone else to do it (TODO, bruce? ;) > We don't? What about some double-casting option? -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Re: Inet type how to?
От:
Alex Pilosov <alex@pilosoft.com>
Дата:
None works. I tried. There is no type that can be cast to inet. And inet_in has a different calling sequence, and you can't really use that. -alex On Fri, 2 Jun 2000, Bruce Momjian wrote: > > It works for me for \copy (which uses inserts) > > > > But yes, there is no way to convert text to inet, which is a pain. When it > > annoys me sufficiently, I think I'll write text_inet wrapping inet_in...Or > > just wait for someone else to do it (TODO, bruce? ;) > > > > We don't? What about some double-casting option? > >
Re: Inet type how to?
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
> None works. I tried. There is no type that can be cast to inet. And > inet_in has a different calling sequence, and you can't really use that. Added to TODO. > > -alex > > On Fri, 2 Jun 2000, Bruce Momjian wrote: > > > > It works for me for \copy (which uses inserts) > > > > > > But yes, there is no way to convert text to inet, which is a pain. When it > > > annoys me sufficiently, I think I'll write text_inet wrapping inet_in...Or > > > just wait for someone else to do it (TODO, bruce? ;) > > > > > > > We don't? What about some double-casting option? > > > > > > -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Re: Inet type how to?
От:
Olivier PRENANT <ohp@pyrenet.fr>
Дата:
You're right... No way; However despite what I said befor it works.. until text is ''; maybe this could be casted as NULL?? Regards, On Fri, 2 Jun 2000, Alex Pilosov wrote: > None works. I tried. There is no type that can be cast to inet. And > inet_in has a different calling sequence, and you can't really use that. > > -alex > > On Fri, 2 Jun 2000, Bruce Momjian wrote: > > > > It works for me for \copy (which uses inserts) > > > > > > But yes, there is no way to convert text to inet, which is a pain. When it > > > annoys me sufficiently, I think I'll write text_inet wrapping inet_in...Or > > > just wait for someone else to do it (TODO, bruce? ;) > > > > > > > We don't? What about some double-casting option? > > > > > -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) Quartier d'Harraud Turrou +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: ohp@pyrenet.fr ------------------------------------------------------------------------------ Make your life a dream, make your dream a reality. (St Exupery)
Re: Inet type how to?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
>> None works. I tried. There is no type that can be cast to inet. And >> inet_in has a different calling sequence, and you can't really use that. > Added to TODO. If we had "C string" (or something like that) as a genuine type in the type system, then it would be possible/reasonable for the parser to understandtextvariable::cstring::inet as a request to invoke text_out followed by inet_in. I think it'd be a real bad idea to invoke such conversions silently, since then we'd essentially have no type system at all (you could get from anything to anything else via cstring, so how can the thing check for errors?). But it'd be awful darn handy to be able to invoke the type i/o routines explicitly... regards, tom lane
Re: Inet type how to?
От:
Alex Pilosov <alex@pilosoft.com>
Дата:
On Fri, 2 Jun 2000, Tom Lane wrote: > >> None works. I tried. There is no type that can be cast to inet. And > >> inet_in has a different calling sequence, and you can't really use that. > > > Added to TODO. > > If we had "C string" (or something like that) as a genuine type in the > type system, then it would be possible/reasonable for the parser to > understand > textvariable::cstring::inet > as a request to invoke text_out followed by inet_in. > > I think it'd be a real bad idea to invoke such conversions silently, > since then we'd essentially have no type system at all (you could get > from anything to anything else via cstring, so how can the thing check > for errors?). But it'd be awful darn handy to be able to invoke the > type i/o routines explicitly... I think its a great idea. Is it just a matter of altering the catalog? Or apparently we'd need postgres engine to know that cstring is a special type and instead of looking for conversion routines it should use xxx_in and yyy_out I like it in any case. Last ditch do-not-use-unless-you-sure-its-what you want thingy... -alex