pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hannu Krosing <hannu@trust.ee>
To: David Hartwig <daveh@insightdist.com>
Cc: Bruce Momjian <maillist@candle.pha.pa.us>
Cc: Hannu Krosing <hannu@trust.ee>
Cc: byronn@insightdist.com
Cc: pgsql-hackers@postgreSQL.org
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Date: Thu, 23 Apr 1998 23:26:25 +0300
Message-ID: <353FA3F1.F5FC0996@sid.trust.ee> (raw)
References: <199804231736.NAA29768@candle.pha.pa.us>
	<353F96B3.E75DB188@insightdist.com>

David Hartwig wrote:
> 
> Bruce Momjian wrote:
> 
> > >
> > > In the latter case, I would suggest an additional SQL command for open
> > > cursors,
> > > or a pseudo table for open cursor where you could do a simple select
> > > statement:
> > >
> > > DECLARE CURSOR FOO_CURSOR FOR SELECT * FROM MYTABLE;
> > >
> > > SELECT _FIELD_NAME,_FIELD_TYPE,_FIELD_SIZE FROM
> > > FOO_CURSOR_INFO_PSEUTOTABLE;
> >
> > The information you want is in pg_attribute.atttypmod.  It is normally
> > -1, but is set for char() and varchar() fields, and includes the 4-byte
> > length.  See bin/psql/psql.c for a sample of its use.

is this on client side or server side?

Last time I checked (it was in 6.2 protocol) it was not sent to client.

What I need is the defined max length of varchar (or char), not just
actual length of each field of that type. This is used by Borlands BDE,
and if this changes, depending on the where clause, it breaks BDE.

> I see everyone writing in terms of length.   You do mean precision, don't
> you? 

in case varchars have precision, yes ;)

>   For our purposes, this precision should  arrive in the result
> header.   (redundancy in each tuple could be over looked)   The goal is to be
> able to put realistic bounds on memory allocation before the entire result is
> read in.   For this to work, functions must also be able to propagate the
> their precision.

Yes, the functions should behave as objects, so that you can get
metadata on them.

So functions should know, depending on max lengths of their arguments,
how long strings they return.

But even without this functionality, having this info is essential to
getting Borland stuff to work.

> Did I spell doom to this idea?

I hope not.

Hannu



view thread (41+ messages)  latest in thread

Message-ID: <353FA3F1.F5FC0996@sid.trust.ee>
Permalink:  ../353FA3F1.F5FC0996@sid.trust.ee/
Also on:    postgresql.org/message-id/353FA3F1.F5FC0996@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, daveh@insightdist.com, maillist@candle.pha.pa.us, byronn@insightdist.com, pgsql-hackers@postgreSQL.org
  Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
  In-Reply-To: <353FA3F1.F5FC0996@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