Re: [GENERAL] Data types for IP address.

2011-02-24 Thread Gaini Rajeshwar
On Thu, Feb 24, 2011 at 1:10 AM, Michael Glaesemann wrote:

>
> On Feb 23, 2011, at 13:49, John R Pierce wrote:
>
> > On 02/23/11 4:44 AM, Stephane Bortzmeyer wrote:
> >>> *3. Start-End IP format :*  1.2.3.0-1.2.3.255
> >> You don't even need to program the conversion, it is already done:
> >>
> >> % netmask 1.2.3.0:1.2.3.255
> >> 1.2.3.0/24
> >
> > yes, but what about 10.1.2.57-10.1.2.123 ?presumably valid in his
> range system, and certainly NOT a valid CIDR range.
>
> If it hasn't been mentioned already, take a look at ip4r. <
> http://pgfoundry.org/projects/ip4r/>
>

I will look into it. May i know how to use this data type? It is not
available with postgreSQL 8.4 right?
I guess i have to download and integrate into postgreSQL, any suggestions on
how to do?

>
> Michael Glaesemann
> grzm seespotcode net
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


Re: [GENERAL] Data types for IP address.

2011-02-24 Thread Gaini Rajeshwar
On Thu, Feb 24, 2011 at 3:03 AM, Tom Lane  wrote:

> John R Pierce  writes:
> > On 02/23/11 4:44 AM, Stephane Bortzmeyer wrote:
> > *3. Start-End IP format :*  1.2.3.0-1.2.3.255
> >> You don't even need to program the conversion, it is already done:
> >>
> >> % netmask 1.2.3.0:1.2.3.255
> >> 1.2.3.0/24
>
> > yes, but what about 10.1.2.57-10.1.2.123 ?presumably valid in his
> > range system, and certainly NOT a valid CIDR range.
>


>
> The question is does he actually have a use-case for address ranges that
> don't correspond to legal CIDR ranges, but do nonetheless have an
> identifiable lower boundary, upper boundary, and no holes?  And if so,
> what is it?  The whole thing looked to me like somebody inventing
> requirements with little or no study of what they really needed.
>

   I have customers who wanted to access application from different
locations without using login credentials every time. So they wanted to
register their ip addresses and  have automated authentication for them. As
i don't know how their ip addresses definitely going to be, i am assuming
that they might have a ip address rage that is not a valid CIDR.


>regards, tom lane
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread John R Pierce

On 02/23/11 1:33 PM, Tom Lane wrote:

The question is does he actually have a use-case for address ranges that
don't correspond to legal CIDR ranges, but do nonetheless have an
identifiable lower boundary, upper boundary, and no holes?  And if so,
what is it?  The whole thing looked to me like somebody inventing
requirements with little or no study of what they really needed.


indeed.i had to poke around the ban tables of MyBB the other day (a 
php bbs that works reasonably well* on postgresql), and they were 
storing IP bans as strings like 1.2.*.* or 1.2.3.4-1.2.4.5 or whatever. 
  UGH.





* it works mostly on PG but has some bugs around the edges of the admin 
stuff. the worst ones I've found fixes for and submitted back to the 
mybb team, but mostly I'm too lazy and just work around them




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Tom Lane
John R Pierce  writes:
> On 02/23/11 4:44 AM, Stephane Bortzmeyer wrote:
> *3. Start-End IP format :*  1.2.3.0-1.2.3.255
>> You don't even need to program the conversion, it is already done:
>> 
>> % netmask 1.2.3.0:1.2.3.255
>> 1.2.3.0/24

> yes, but what about 10.1.2.57-10.1.2.123 ?presumably valid in his 
> range system, and certainly NOT a valid CIDR range.

The question is does he actually have a use-case for address ranges that
don't correspond to legal CIDR ranges, but do nonetheless have an
identifiable lower boundary, upper boundary, and no holes?  And if so,
what is it?  The whole thing looked to me like somebody inventing
requirements with little or no study of what they really needed.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Michael Glaesemann

On Feb 23, 2011, at 13:49, John R Pierce wrote:

> On 02/23/11 4:44 AM, Stephane Bortzmeyer wrote:
>>> *3. Start-End IP format :*  1.2.3.0-1.2.3.255
>> You don't even need to program the conversion, it is already done:
>> 
>> % netmask 1.2.3.0:1.2.3.255
>> 1.2.3.0/24
> 
> yes, but what about 10.1.2.57-10.1.2.123 ?presumably valid in his range 
> system, and certainly NOT a valid CIDR range.

If it hasn't been mentioned already, take a look at ip4r. 


Michael Glaesemann
grzm seespotcode net




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread John R Pierce

On 02/23/11 4:44 AM, Stephane Bortzmeyer wrote:

*3. Start-End IP format :*  1.2.3.0-1.2.3.255

You don't even need to program the conversion, it is already done:

% netmask 1.2.3.0:1.2.3.255
 1.2.3.0/24


yes, but what about 10.1.2.57-10.1.2.123 ?presumably valid in his 
range system, and certainly NOT a valid CIDR range.




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Stephane Bortzmeyer
On Wed, Feb 23, 2011 at 05:39:26PM +0530,
 Gaini Rajeshwar  wrote 
 a message of 52 lines which said:

> I wanted to store ip addresses in table. I wanted to support the following 3
> types of ip addresses.
> 
> *1. Wildcard format :* 1.2.3.*
> *
> *
> *2. CIDR format:* 1.2.3/24  OR  1.2.3.4/255.255.255.0

What is the difference between 1.2.3.* and 1.2.3.0/24? For me, it is
exactly the same. If you just want the ability to INPUT 1.2.3.*, just
write a small conversion routine in your favorite programming
language.

> *3. Start-End IP format :*  1.2.3.0-1.2.3.255

You don't even need to program the conversion, it is already done:

% netmask 1.2.3.0:1.2.3.255 
1.2.3.0/24

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Stephane Bortzmeyer
On Wed, Feb 23, 2011 at 02:30:18PM +0200,
 Sim Zacks  wrote 
 a message of 97 lines which said:

> a regular varchar or text field.

Very bad idea since they don't support canonicalization (2001:db8::1
== 2001:db8:0:0:0:0:0:1) or masking (set_masklen(address, 20)).

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Sim Zacks

a regular varchar or text field.


On 02/23/2011 02:09 PM, Gaini Rajeshwar wrote:


Hi All,

I wanted to store ip addresses in table. I wanted to support the 
following 3 types of ip addresses.


|*1. Wildcard format :* 1.2.3.*
*
*|
|*2. CIDR format:* 1.2.3/24  OR 1.2.3.4/255.255.255.0 


*
*|
|*3. Start-End IP format :*  1.2.3.0-1.2.3.255

|
|
|
I had a look at CIDR datatype and inet datatype but it seems they 
support only partial of the above requirements. Any suggestions on 
what datatype is useful for this purpose?


Thanks




[GENERAL] Data types for IP address.

2011-02-23 Thread Gaini Rajeshwar
Hi All,

I wanted to store ip addresses in table. I wanted to support the following 3
types of ip addresses.

*1. Wildcard format :* 1.2.3.*
*
*
*2. CIDR format:* 1.2.3/24  OR  1.2.3.4/255.255.255.0
*
*
*3. Start-End IP format :*  1.2.3.0-1.2.3.255


I had a look at CIDR datatype and inet datatype but it seems they support
only partial of the above requirements. Any suggestions on what datatype is
useful for this purpose?

Thanks


Re: [GENERAL] Data Types

2008-06-23 Thread Mike Gould
Thanks for all of the replies.

Best Regards,

Michael Gould, Manager Information Technology
All Coast Intermodal Services, Inc.
904-226-0978
  _  

From: Tom Lane [mailto:[EMAIL PROTECTED]
To: Roberts, Jon [mailto:[EMAIL PROTECTED]
Cc: [EMAIL PROTECTED], pgsql-general General [mailto:[EMAIL PROTECTED]
Sent: Mon, 23 Jun 2008 15:00:05 -0400
Subject: Re: [GENERAL] Data Types 

"Roberts, Jon" <[EMAIL PROTECTED]> writes:
  > Character will use more disk space than varchar so it does make a
  > difference.
  
  char also has very peculiar comparison semantics.  Unless your strings
  are really truly fixed-length, you should just about always use varchar.
  
 regards, tom lane
  
  -- 
  Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
  To make changes to your subscription:
  http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data Types

2008-06-23 Thread Tom Lane
"Roberts, Jon" <[EMAIL PROTECTED]> writes:
> Character will use more disk space than varchar so it does make a
> difference.

char also has very peculiar comparison semantics.  Unless your strings
are really truly fixed-length, you should just about always use varchar.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Data Types

2008-06-23 Thread Roberts, Jon
Character will use more disk space than varchar so it does make a
difference.

 

http://www.postgresql.org/docs/8.3/interactive/datatype-character.html

 

Values of type character are physically padded with spaces to the
specified width n, and are stored and displayed that way. However, the
padding spaces are treated as semantically insignificant. Trailing
spaces are disregarded when comparing two values of type character, and
they will be removed when converting a character value to one of the
other string types. Note that trailing spaces are semantically
significant in character varying and text values.

 

 

 

 

Jon

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Gould
Sent: Monday, June 23, 2008 1:01 PM
To: pgsql-general General
Subject: [GENERAL] Data Types

 

We are converting our system from using Sybase's SQL Anywhere 10 to
PostGres 8.3.  In SQL Anywhere there technically isn't any difference in
how a char and varchar is stored. They are all an array of char[1]. So
we always just defined everything as a char since right truncation is
the default.

In PostGres though if we are using a character type column to search
should we define that as a varchar or a char or does it make any
difference?

Best Regards

Michael Gould
Intermodal Software Solutions, LLC.



[GENERAL] Data Types

2008-06-23 Thread Mike Gould
We are converting our system from using Sybase's SQL Anywhere 10 to PostGres 
8.3.  In SQL Anywhere there technically isn't any difference in how a char and 
varchar is stored. They are all an array of char[1]. So we always just defined 
everything as a char since right truncation is the default.

In PostGres though if we are using a character type column to search should we 
define that as a varchar or a char or does it make any difference?

Best Regards

Michael Gould
Intermodal Software Solutions, LLC.

Re: [GENERAL] Data types

2005-12-30 Thread Jonel Rienton

Thank you gentlemen, this will keep me busy for a while. 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James Cradock
Sent: Friday, December 30, 2005 1:05 PM
To: Jonel Rienton
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Data types

Try pg_type. typname should give you what you're looking for.

On Dec 30, 2005, at 1:57 PM, Jonel Rienton wrote:

> Hi guys,
>
> Does Postgres store all the possible column datatypes somewhere in its 
> system tables?  Like int8, int4, character varying, etc. I'm trying to 
> write another GUI client that can list all the database objects in 
> Postgres.
> Thanks.
>
> Regards,
>
> Jonel
>
> --
> I know not english well, but I know 9 computer languages.
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.14.9/217 - Release Date:  
> 12/30/2005
>
>
>
> ---(end of
> broadcast)---
> TIP 4: Have you searched our list archives?
>
>http://archives.postgresql.org
>


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.9/217 - Release Date: 12/30/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.9/217 - Release Date: 12/30/2005
 


---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] Data types

2005-12-30 Thread James Cradock

Try pg_type. typname should give you what you're looking for.

On Dec 30, 2005, at 1:57 PM, Jonel Rienton wrote:


Hi guys,

Does Postgres store all the possible column datatypes somewhere in its
system tables?  Like int8, int4, character varying, etc. I'm trying  
to write

another GUI client that can list all the database objects in Postgres.
Thanks.

Regards,

Jonel

--
I know not english well, but I know 9 computer languages.

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.9/217 - Release Date:  
12/30/2005




---(end of  
broadcast)---

TIP 4: Have you searched our list archives?

   http://archives.postgresql.org




---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [GENERAL] Data types

2005-12-30 Thread Michael Fuhr
On Fri, Dec 30, 2005 at 12:57:57PM -0600, Jonel Rienton wrote:
> Does Postgres store all the possible column datatypes somewhere in its
> system tables?  Like int8, int4, character varying, etc. I'm trying to write
> another GUI client that can list all the database objects in Postgres.

See "System Catalogs" in the documentation; here's a link to the
latest version:

http://www.postgresql.org/docs/8.1/interactive/catalogs.html

You might also want to check out the Information Schema, which is
defined in the SQL standard.

http://www.postgresql.org/docs/8.1/interactive/information-schema.html

-- 
Michael Fuhr

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[GENERAL] Data types

2005-12-30 Thread Jonel Rienton
Hi guys,

Does Postgres store all the possible column datatypes somewhere in its
system tables?  Like int8, int4, character varying, etc. I'm trying to write
another GUI client that can list all the database objects in Postgres.
Thanks.

Regards,

Jonel

-- 
I know not english well, but I know 9 computer languages.

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.9/217 - Release Date: 12/30/2005
 


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


RE: [GENERAL] Data types?

2001-03-08 Thread Trewern, Ben
Title: RE: [GENERAL] Data types? 





I thought:


\dT


This should do it


Ben


> -Original Message-
> From: Tom Lane [mailto:[EMAIL PROTECTED]]
> Sent: 08 March 2001 01:00
> To: Christopher Sawtell
> Cc: Flemming Frøkjær; [EMAIL PROTECTED]
> Subject: Re: [GENERAL] Data types? 
> 
> 
> Christopher Sawtell <[EMAIL PROTECTED]> writes:
> > On Thu, 08 Mar 2001 12:29, Flemming Frøkjær wrote:
> >> How do i find out what data types are available in PostgreSQL.
> 
> > Look in the regression tests. Interesting stuff.
> 
> And there's always "select * from pg_type" ... not to mention 
> the source
> code ...
> 
>           regards, tom lane
> 
> ---(end of 
> broadcast)---
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 





Re: [GENERAL] Data types?

2001-03-07 Thread Tom Lane

Christopher Sawtell <[EMAIL PROTECTED]> writes:
> On Thu, 08 Mar 2001 12:29, Flemming Frøkjær wrote:
>> How do i find out what data types are available in PostgreSQL.

> Look in the regression tests. Interesting stuff.

And there's always "select * from pg_type" ... not to mention the source
code ...

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [GENERAL] Data types?

2001-03-07 Thread Christopher Sawtell

On Thu, 08 Mar 2001 12:29, Flemming Frøkjær wrote:
> How do i find out what data types are available in PostgreSQL.
> I know there are more that the ones in the docs, and i ones saw a
> command to list all the data types. And there was a lot more than the
> ones from the docs.

Look in the regression tests. Interesting stuff.

-- 
Sincerely etc.,

 NAME   Christopher Sawtell
 CELL PHONE 021 257 4451
 ICQ UIN45863470
 EMAIL  csawtell @ xtra . co . nz
 CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

 -->> Please refrain from using HTML or WORD attachments in e-mails to me 
<<--


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[GENERAL] Data types?

2001-03-07 Thread Flemming Frøkjær

How do i find out what data types are available in PostgreSQL.
I know there are more that the ones in the docs, and i ones saw a command
to list all the data types. And there was a lot more than the ones from the
docs.

\Flemming


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])