X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8FA0252885 for ; Mon, 6 Jun 2005 07:50:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43276-04 for ; Mon, 6 Jun 2005 10:50:19 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 99D455289E for ; Mon, 6 Jun 2005 07:50:17 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id C055A408881; Mon, 6 Jun 2005 11:50:12 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 3AE1515ED7; Mon, 6 Jun 2005 11:48:20 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13802-08; Mon, 6 Jun 2005 11:48:17 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 0E66515ED5; Mon, 6 Jun 2005 11:48:17 +0100 (BST) Message-ID: <42A429F0.3040208@archonet.com> Date: Mon, 06 Jun 2005 11:48:16 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vadivel Subramaniam Cc: pgsql-sql@postgresql.org Subject: Re: how to store more than 3 MB of character data in Postgres References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/76 X-Sequence-Number: 21677 Vadivel Subramaniam wrote: > > Hi, > > We have a requirement wherein we have to store around 3 MB of data > in Postgres database. > > We had gone through the postgres website > http://www.postgresql.org/docs/7.4/interactive/datatype-character.html#DATATYPE-CHARACTER-SPECIAL-TABLE > > The above link says "varchar" can store upto 1 GB of data. I don't think it does, it says the "longest possible character string" which covers type "text". > But when > i try to insert using ODBC API's the varchar field takes only 65484 > characters. But i could insert more characters using INSERT SQL > command. Even in this case when we fetch the data it reads only > 65540 characters. Remaining data is not read from the varchar field. So, your problem is with the ODBC interface rather than actually inserting the data. > We have tried in 2 ways > > 1. table is created without any limit specified for varchar. create > table details (name varchar, data varchar); > > 2. create table utilntmlscripts (name character varying, data > character varying(10485770)); ERROR: length for type 'varchar' > cannot exceed 10485760 It's not allowing more than 10 MB of size > during table creation. > > > Is there anything needs to be configured to make the varchar field to > support upto 1 GB. Even if it does not support 1 GB, can we store & > retrieve atleast 10 MB of character data in Varchar field? Check your ODBC settings and try type "text" instead of "varchar". I think the problem is with ODBC restrictions rather than anything else. You should be able to get type "text" to map to a "Memo" type or similar, which should hold more than 64k IIRC. Failing that, try internal type "bytea" and large-object on the ODBC end. -- Richard Huxton Archonet Ltd