Re: TypeInfoCache - Mailing list pgsql-jdbc

From Gregory Stark
Subject Re: TypeInfoCache
Date
Msg-id 873atymzpu.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: TypeInfoCache  (Daniel Migowski <dmigowski@ikoffice.de>)
Responses Re: TypeInfoCache  (Daniel Migowski <dmigowski@ikoffice.de>)
Re: TypeInfoCache  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-jdbc
"Daniel Migowski" <dmigowski@ikoffice.de> writes:

>> Why?
>
> Because VARCHAR (in my understanding) has some limit, like 256 or 50 or even
> 8192, whatever.

yes, 2GB, same as text.

> LONGVARCHAR is unlimited as I understand and much better
> matches what i understood what "text" is for.

Well you haven't explained what you understand "text" is for but in Postgres
they can be used pretty much interchangeably.

I think this has come up before, you should check the mail archives. The
problem is that describing "text" as if it's not a simple varchar type of type
confuses other applications into restricting what you can do with it. They
assume it has the kind of restrictions other databases impose.

Generally in Postgres you're probably best off using "text" unless you have
some specific limit you need to impose. In most cases Postgres will silently
cast your varchars to text when necessary but every now and then you might
find a case where it doesn't and fails to use an index or optimize a query
where it could.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: setting PreparedStatement parameter using "at time zone interval ?"
Next
From: Daniel Migowski
Date:
Subject: Re: TypeInfoCache