Received: from sid.trust.ee (root@sid.trust.ee [194.204.23.180]) by hub.org (8.8.8/8.7.5) with ESMTP id MAA27820; Thu, 23 Apr 1998 12:26:16 -0400 (EDT) Received: from sid.trust.ee (wink.trust.ee [194.204.23.184]) by sid.trust.ee (8.8.5/8.8.5) with ESMTP id TAA00220; Thu, 23 Apr 1998 19:25:32 +0300 Message-ID: <353F6BBC.50EB8C99@sid.trust.ee> Date: Thu, 23 Apr 1998 19:26:36 +0300 From: Hannu Krosing X-Mailer: Mozilla 4.05 [en] (Win95; I) MIME-Version: 1.0 To: Byron Nikolaidis CC: PostgreSQL Hacker , "pgsql-interfaces@postgreSQL.org" Subject: Re: [INTERFACES] retrieving varchar size References: <353F5423.85F6FBCB@insightdist.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Byron Nikolaidis wrote: > > Hello, > > I was wondering if it would be possible, in the Postgres backend, to > send back the defined column size for the varchar data type (and > possibly the char() type, i.e., bpchar) on a query? Currently, it just > sends back -1 for the size, which makes it difficult in the frontend > (i.e., odbc driver) to determine what the size of the column is. While the right solution to this is of course getting the size from backend, there exists a workaround now (assuming that the query is not too expensive). While ASCII cursors always hide the varchar sizes, binary ones return the size in actual data (by zero-padding the returned data to max size), so one can determine the actual max sizes by opening the query in binary cursor and then examining enough records to get one non-null field for each varchar field. Hannu