Re: [SQL] inet/cidr - can this be done?

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [SQL] inet/cidr - can this be done?
Дата
Msg-id Pine.GSO.4.02A.10001311317150.12762-100000@Hund.DoCS.UU.SE
обсуждение исходный текст
Ответ на inet/cidr - can this be done?  (Mark Volpe <volpe.mark@epamail.epa.gov>)
Список pgsql-sql
The problem is that host(ip)||'/24' isn't of the inet type, it's text. For
a simple select query you don't have to cast this at all, it would seem,
since it goes as text to the frontend either way.

Also, a straightforward cast inet_value::cidr seems to work for me.


On Sat, 29 Jan 2000, Mark Volpe wrote:

> Is there a way to convert inet types
> to cidr? I have a table with an inet
> field, and it would be cool to, say,
> group by class C network. My little attempt
> here results in an error:
> 
> CREATE TABLE test(ip inet);
> INSERT INTO test VALUES('192.168.1.2');
> SELECT (host(ip) || '/24')::cidr FROM test;
> 
> ERROR:  No such function 'cidr' with the specified attributes
> 
> Thanks in advance
> - Mark
> 
> ************
> 
> 

-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



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

Предыдущее
От: wieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] Help with pl/pgsql, triggers, and foreign keys
Следующее
От: Marc Tardif
Дата:
Сообщение: now() returning int4