Re: [INTERFACES] retrieving varchar size

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: Byron Nikolaidis <byronn(at)insightdist(dot)com>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgreSQL(dot)org>, "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] retrieving varchar size
Date: 1998-04-23 16:26:36
Message-ID: 353F6BBC.50EB8C99@sid.trust.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gran Thyni 1998-04-23 16:29:22 Re: [HACKERS] Re: [QUESTIONS] How to use memory instead of hd?
Previous Message Tom Lane 1998-04-23 16:11:29 Re: [HACKERS] Removing PORTNAME from libpq/Makefile

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Moss 1998-04-23 16:34:35 Can't connect with ODBC
Previous Message Peter Mount 1998-04-23 15:32:57 RE: [INTERFACES] JBuilder QueryDataSet: Can't browse tables in Query Editor