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

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

From: David Hartwig <daveh(at)insightdist(dot)com>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: 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 19:29:55
Message-ID: 353F96B3.E75DB188@insightdist.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-interfaces

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.

I see everyone writing in terms of length.   You do mean precision, don't
you?    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.

Did I spell doom to this idea?

Attachment: vcard.vcf
Description: text/x-vcard (204 bytes)

In response to

Responses

pgsql-hackers by date

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

pgsql-interfaces by date

Next:From: Hannu KrosingDate: 1998-04-23 20:26:25
Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Previous:From: David HartwigDate: 1998-04-23 19:11:04
Subject: ODBC Doc

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