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 AB24C52891 for ; Mon, 6 Jun 2005 08:55:29 -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 52272-10 for ; Mon, 6 Jun 2005 11:55:20 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 073BC52921 for ; Mon, 6 Jun 2005 08:55:19 -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 2EC77414AFD; Mon, 6 Jun 2005 12:55:14 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id BD2A815F12; Mon, 6 Jun 2005 12:51:21 +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 16418-02; Mon, 6 Jun 2005 12:51:16 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9C7A615ED6; Mon, 6 Jun 2005 12:46:25 +0100 (BST) Message-ID: <42A43791.7030306@archonet.com> Date: Mon, 06 Jun 2005 12:46:25 +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 , pgsql-sql 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/77 X-Sequence-Number: 21678 Vadivel Subramaniam wrote: > > I assume, it could not be a problem with ODBC. I am able to store 2.5 MB of > data into Oracle using the same ODBC APIs. Well, it certainly isn't to do with PG itself: $ cat bigtest.pl #!/usr/bin/perl print "CREATE TABLE foo (a int, b varchar);\n"; print "INSERT INTO foo VALUES (1, '".('a' x 5000000)."');\n"; $ perl bigtest.pl | psql -Urichardh richardh CREATE TABLE INSERT 3634376 1 $ psql -Urichardh richardh richardh=> SELECT a,length(b) FROM foo; a | length ---+--------- 1 | 5000000 (1 row) > Only difference is that Oracle supports CLOB datatype, that is mapped to > LONG VARCHAR in ODBC. > The input parameter during insert is bound using the below ODBC API > retStatus = SQLBindParameter(dStmtHandle, 1, SQL_PARAM_INPUT, > SQL_C_CHAR, SQL_LONGVARCHAR, dLen, 1, pData, 0, &dLen); > > For PostGres also the same API is used. Here varchar/text at the Postgres > schema is mapped to LONGVARCHAR at ODBC. > We can not go for bytea etc, since the data is in character format. > > I tried using "text" also at the postgres schema, still the impact is same > (only stores around 64K). > Could you please provide some example, how the large character data ( more > than 1 MB ) can be inserted to text/varchar (in PostGres) using ODBC? Hmm - looking back at your original email, I see you're using the UnixODBC driver. Might be worth trying the PG version: http://gborg.postgresql.org/project/psqlodbc/genpage.php?downloads First step though, should be to check whether there are any configuration settings that apply to longvarchar, because it sounds like the odbc driver should be mapping to that. I can't help you with finding those settings, since I have only ever used the "official" PG driver on Windows. -- Richard Huxton Archonet Ltd