pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTEXT::CIDR/INET::CIDR output confusion
3+ messages / 3 participants
[nested] [flat]
* TEXT::CIDR/INET::CIDR output confusion
@ 2004-11-12 21:31 Alexander M. Pravking <fduch@antar.bryansk.ru>
2004-11-30 04:49 ` Re: TEXT::CIDR/INET::CIDR output confusion Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Alexander M. Pravking @ 2004-11-12 21:31 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: TEXT::CIDR/INET::CIDR output confusion
2004-11-12 21:31 TEXT::CIDR/INET::CIDR output confusion Alexander M. Pravking <fduch@antar.bryansk.ru>
@ 2004-11-30 04:49 ` Bruce Momjian <pgman@candle.pha.pa.us>
2004-11-30 05:07 ` Re: TEXT::CIDR/INET::CIDR output confusion Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Momjian @ 2004-11-30 04:49 UTC (permalink / raw)
To: Alexander M. Pravking <fduch@antar.bryansk.ru>; +Cc: 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
zero the 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, Pennsylvania 19073
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: TEXT::CIDR/INET::CIDR output confusion
2004-11-12 21:31 TEXT::CIDR/INET::CIDR output confusion Alexander M. Pravking <fduch@antar.bryansk.ru>
2004-11-30 04:49 ` Re: TEXT::CIDR/INET::CIDR output confusion Bruce Momjian <pgman@candle.pha.pa.us>
@ 2004-11-30 05:07 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2004-11-30 05:07 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; +Cc: Alexander M. Pravking <fduch@antar.bryansk.ru>; pgsql-sql
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> 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.
That's what it seems to boil down to. We need to rethink the separation
between those datatypes. At the very least, the casts between them
cannot both be code-less binary-compatibility casts.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-11-30 05:07 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-12 21:31 TEXT::CIDR/INET::CIDR output confusion Alexander M. Pravking <fduch@antar.bryansk.ru>
2004-11-30 04:49 ` Bruce Momjian <pgman@candle.pha.pa.us>
2004-11-30 05:07 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox