Re: How to covert 'char' to 'inet'
От | Andrew Sullivan |
---|---|
Тема | Re: How to covert 'char' to 'inet' |
Дата | |
Msg-id | 20020725101826.A29680@mail.libertyrms.com обсуждение исходный текст |
Ответ на | Re: How to covert 'char' to 'inet' (mnihas@poczta.onet.pl (Michal O)) |
Ответы |
Re: How to covert 'char' to 'inet'
|
Список | pgsql-general |
On Wed, Jul 24, 2002 at 01:40:01AM -0700, Michal O wrote: > Thank you. What I did was: > > inet(trim(both ' ' from server_ip::text)) > > and worked fine. Convertion to 'text' was needed. > Do you know how time consuming it is ? Is there more efficient way ? No, as I say, char() is padded, and spaces (or whatever) are not legal in IP addresses. So, if you have a char field with data 10.0.0.1, its actual representation is something more like '10.0.0.1_______', where '_' is the padding. This is the same problem you would have if you inserted the char() field into a newly-created varchar() field: you'd get the padded text instead. That's a reason to avoid using char() for most cases, unless you know that the field will _always_ be the same length. A -- ---- Andrew Sullivan 87 Mowat Avenue Liberty RMS Toronto, Ontario Canada <andrew@libertyrms.info> M6K 3E3 +1 416 646 3304 x110
В списке pgsql-general по дате отправления: