Received: from u1.abs.net (root@u1.abs.net [207.114.0.131]) by hub.org (8.8.8/8.7.5) with ESMTP id QAA04059 for ; Thu, 23 Apr 1998 16:00:28 -0400 (EDT) Received: from insightdist.com (nobody@localhost) by u1.abs.net (8.8.5/8.8.5) with UUCP id PAA14662 for pgsql-hackers@postgreSQL.org; Thu, 23 Apr 1998 15:47:56 -0400 (EDT) X-Authentication-Warning: u1.abs.net: nobody set sender to insightdist.com!daveh using -f Received: by insightdist.com (AIX 3.2/UCB 5.64/4.03) id AA18628; Thu, 23 Apr 1998 15:40:22 -0400 Received: from daveh by ceodev (AIX 4.1/UCB 5.64/4.03) id AA19468; Thu, 23 Apr 1998 15:31:58 -0400 Message-Id: <353F96B3.E75DB188@insightdist.com> Date: Thu, 23 Apr 1998 15:29:55 -0400 From: David Hartwig Organization: Insight Distribution Systems X-Mailer: Mozilla 4.05 [en] (Win95; I) Mime-Version: 1.0 To: Bruce Momjian Cc: Hannu Krosing , byronn@insightdist.com, pgsql-hackers@postgreSQL.org, pgsql-interfaces@postgreSQL.org Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size References: <199804231736.NAA29768@candle.pha.pa.us> Content-Type: multipart/mixed; boundary="------------E6FD65A2612A56613AB610C4" This is a multi-part message in MIME format. --------------E6FD65A2612A56613AB610C4 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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? --------------E6FD65A2612A56613AB610C4 Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for David Hartwig Content-Disposition: attachment; filename="vcard.vcf" begin: vcard fn: David Hartwig n: Hartwig;David email;internet: daveh@insightdist.com x-mozilla-cpt: ;0 x-mozilla-html: FALSE version: 2.1 end: vcard --------------E6FD65A2612A56613AB610C4--