Re: TEXT::CIDR/INET::CIDR output confusion

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: TEXT::CIDR/INET::CIDR output confusion
Дата
Msg-id 200411300449.iAU4nkl07211@candle.pha.pa.us
обсуждение исходный текст
Ответ на TEXT::CIDR/INET::CIDR output confusion  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
Ответы Re: TEXT::CIDR/INET::CIDR output confusion
Список pgsql-sql
Added to TODO list:
* Prevent INET cast to CIDR from droping netmask, SELECT  '1.1.1.1'::inet::cidr

It is probably related to the TODO item above it:* Prevent INET cast to CIDR if the unmasked bits are not zero, or
zerothe bits
 

I think the original code thought CIDR and INET where identical types
that could be cast with no changes but we are finding that was incorrect.

---------------------------------------------------------------------------

Alexander M. Pravking wrote:
> It looks a bit strange that CIDR output depends on datatype it has been
> casted from:
> 
> fduch=# SELECT '1.1.1.1'::cidr;
>     cidr
> ------------
>  1.1.1.1/32
> (1 row)
> 
> fduch=# SELECT '1.1.1.1'::inet::cidr;
>   cidr
> ---------
>  1.1.1.1
> (1 row)
> 
> 
> However these two seem to be 'equal' in terms of backend:
> 
> fduch=# SELECT '1.1.1.1'::inet::cidr = '1.1.1.1'::inet;
>  ?column?
> ----------
>  t
> (1 row)
> 
> fduch=# SELECT '1.1.1.1'::inet::cidr = '1.1.1.1'::cidr;
>  ?column?
> ----------
>  t
> (1 row)
> 
> 
> I'm just curious how can it even be...
> 
> fduch=# SELECT version();
>                                             version
> ------------------------------------------------------------------------------------------------
>  PostgreSQL 7.4.5 on i386-portbld-freebsd5.3, compiled by GCC cc (GCC) 3.4.2 [FreeBSD] 20040728
> 
> 
> -- 
> Fduch M. Pravking
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: create stored procedure from temporary table
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: stored procedures in postgresql user plpgsql