Skip site navigation (1) Skip section navigation (2)

Re: PSQL Data Type: text vs. varchar(n)

From: Chris <dmagick(at)gmail(dot)com>
To: kurt _ <kjs216(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PSQL Data Type: text vs. varchar(n)
Date: 2006-03-31 03:04:10
Message-ID: 442C9C2A.5010900@gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
kurt _ wrote:
> I am having a problem with Sun Java Studio Creator because the latest 
> version of the JDBC driver returns a field length of -1 for text fields.
> 
> My question:  Is a text field just a varchar(Integer.MAX_VALUE)?  If I 
> want to use the data binding part of the SJSC tool I will need to 
> convert my text fields to some standard SQL data type.  I understand 
> that varchar just stores the actual length of the field, and not the 
> padded white space.  Would anyone recommend for or against creating a 
> field of varchar(Integer.MAX_VALUE)?  Will PostgreSQL choke on that?  If 
> against, how is text implemented and how can I represent a 
> variable-length String in a SQL standard format?

varchar has a max of 255 characters, so yeh it'll choke using 
integer.max_value.

http://www.postgresql.org/docs/8.1/interactive/datatype-character.html 
has details on how string fields are stored and the differences.

-- 
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Responses

pgsql-general by date

Next:From: Bruce MomjianDate: 2006-03-31 04:09:39
Subject: Re: FAQ 1.1
Previous:From: ChrisDate: 2006-03-31 02:59:01
Subject: Re: checking data type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group