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)


Fri, 2 Jun 2000 18:27:47 +0200 (MET DST)
Olivier PRENANT <ohp@pyrenet.fr>
Inet type how to?
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
> 
> 


Fri, 2 Jun 2000 13:41:54 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
Re: Inet type how to?
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)


Fri, 2 Jun 2000 19:48:49 +0200 (MET DST)
Olivier PRENANT <ohp@pyrenet.fr>
Re: Inet type how to?
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
> > > 
> > > 
> > 
> 
> 


Fri, 2 Jun 2000 16:07:49 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
Re: Inet type how to?
> 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

Fri, 2 Jun 2000 16:32:07 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Inet type how to?
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?
> 
> 


Fri, 2 Jun 2000 16:36:43 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
Re: Inet type how to?
> 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

Fri, 2 Jun 2000 16:38:30 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Inet type how to?
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)


Fri, 2 Jun 2000 22:40:02 +0200 (MET DST)
Olivier PRENANT <ohp@pyrenet.fr>
Re: Inet type how to?
>> 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...

			regards, tom lane

Fri, 02 Jun 2000 18:24:47 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Inet type how to? 
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


Fri, 2 Jun 2000 18:31:37 -0400 (EDT)
Alex Pilosov <alex@pilosoft.com>
Re: Inet type how to? 