Re: Cleaning up the INET/CIDR mess

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Cleaning up the INET/CIDR mess
Дата
Msg-id 200602011607.k11G7il15887@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Cleaning up the INET/CIDR mess  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Cleaning up the INET/CIDR mess  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > I agree.  Let's do the zeroing and see if people complain about it.
> 
> I'm complaining.  Losing data on a cast is not common behavior.

[ Sorry for the delay.]

OK, that's clear.  :-)

I looked around to see if I could find any places where we implicitly
cast and lose data.  I tried factorial(3.2), and that cast failed.

However, if I do this explicit cast:
test=> SELECT '3.4'::float8::integer; int4------    3(1 row)

it works.  Can't we consider this:
test=> SELECT '1.2.3.4/24'::inet::cidr;    cidr------------ 1.2.3.0/24(1 row)

a similar situation?  inet is like float8 (bits beyond the masklen),
while cidr is like int4.

Is it only implicit casts you are worried about?  Do we have any of
those left?  All functions that take cidr also have an inet version, so
I don't see how an implicit cast to cidr could happen.

--  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-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: A note about testing EXEC_BACKEND on recent Linuxen
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Cleaning up the INET/CIDR mess