Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C32702E0268 for ; Wed, 19 Dec 2007 14:13:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 75566-02 for ; Wed, 19 Dec 2007 14:12:53 -0400 (AST) Received: from ikoffice.de (ikoffice.de [81.169.166.92]) by postgresql.org (Postfix) with ESMTP id 32C582E2DA7 for ; Wed, 19 Dec 2007 14:13:21 -0400 (AST) Received: from p5481bbf0.dip.t-dialin.net ([84.129.187.240] helo=[192.168.1.16]) by ikoffice.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.66) (envelope-from ) id 1J53Pu-0000tO-30; Wed, 19 Dec 2007 19:13:15 +0100 Message-ID: <4769604A.9050006@ikoffice.de> Date: Wed, 19 Dec 2007 19:17:46 +0100 From: Daniel Migowski User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Gregory Stark CC: pgsql-jdbc@postgresql.org Subject: Re: TypeInfoCache References: <47692DEB.9070307@ikoffice.de> <877ijan2cp.fsf@oxford.xeocode.com> <47693B10.3040804@ikoffice.de> <873atymzpu.fsf@oxford.xeocode.com> In-Reply-To: <873atymzpu.fsf@oxford.xeocode.com> Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Bar: - X-Spam-Score-Int: -13 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/152 X-Sequence-Number: 18007 Gregory Stark schrieb:
"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.
  
I meant the limit you give it. Not the internal one. VARCHAR(50) has a limit of 50, right?
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 a VARCHAR(50) and text are not interchangeable.
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.
  
Which restrictions does an JDBC-LONGVARCHAR impose? Read the JDBC spec, please, where they say they are interchangeable reagrding all Access methods? Like in PostgreSQL. But a LONGVARCHAR is IMHO commonly regarded as "very much text", while a VARCHAR(n) is regarded as "up to n chars" of text.
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.
  
This one is new to me. Does this mean even storage is done the same for text and varchar? Does this mean I could savely convert all my varchar's to text (if my client application accepts this?)

With best regards,
Daniel Migowski

PS: Now searching the archives...

--
 |¯¯|¯¯|    IKOffice GmbH             Daniel Migowski
 |  |  |/|                            Mail: dmigowski@ikoffice.de
 |  | // |  Nordstr. 10               Tel.: +49 (441) 21 98 89 52
 |  | \\ |  26135 Oldenburg           Fax.: +49 (441) 21 98 89 55
 |__|__|\|  http://www.ikoffice.de    Mob.: +49 (176) 22 31 20 76
 
            Geschäftsführer: Ingo Kuhlmann, Daniel Migowski
            Amtsgericht Oldenburg, HRB 201467
            Steuernummer: 64/211/01864