Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Re: [INTERFACES] retrieving varchar size

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: David Hartwig <daveh(at)insightdist(dot)com>
Cc: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>, Hannu Krosing <hannu(at)trust(dot)ee>, byronn(at)insightdist(dot)com, pgsql-hackers(at)postgreSQL(dot)org, pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Date: 1998-04-23 20:26:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-interfaces
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:
> > >
> > >
> >
> > 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.


In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-04-23 21:09:40
Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Previous:From: Darren KingDate: 1998-04-23 20:25:39
Subject: linux, bsd, i386-solaris and univel shared libraries.

pgsql-interfaces by date

Next:From: Bruce MomjianDate: 1998-04-23 21:09:40
Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Previous:From: David HartwigDate: 1998-04-23 19:29:55
Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group