pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hannu Krosing <hannu@trust.ee>
To: Byron Nikolaidis <byronn@insightdist.com>
Cc: PostgreSQL Hacker <pgsql-hackers@postgreSQL.org>
Cc: pgsql-interfaces@postgreSQL.org <pgsql-interfaces@postgreSQL.org>
Subject: Re: [INTERFACES] retrieving varchar size
Date: Thu, 23 Apr 1998 19:26:36 +0300
Message-ID: <353F6BBC.50EB8C99@sid.trust.ee> (raw)
References: <353F5423.85F6FBCB@insightdist.com>

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



view thread (41+ messages)  latest in thread

Message-ID: <353F6BBC.50EB8C99@sid.trust.ee>
Permalink:  ../353F6BBC.50EB8C99@sid.trust.ee/
Also on:    postgresql.org/message-id/353F6BBC.50EB8C99@sid.trust.ee

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: hannu@trust.ee, byronn@insightdist.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [INTERFACES] retrieving varchar size
  In-Reply-To: <353F6BBC.50EB8C99@sid.trust.ee>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox