Received: from candle.pha.pa.us (maillist@s5-03.ppp.op.net [209.152.195.67]) by hub.org (8.8.8/8.7.5) with ESMTP id RAA17555; Thu, 23 Apr 1998 17:10:03 -0400 (EDT) Received: (from maillist@localhost) by candle.pha.pa.us (8.8.5/8.8.5) id RAA08650; Thu, 23 Apr 1998 17:09:40 -0400 (EDT) From: Bruce Momjian Message-Id: <199804232109.RAA08650@candle.pha.pa.us> Subject: Re: [HACKERS] Re: [INTERFACES] retrieving varchar size To: daveh@insightdist.com (David Hartwig) Date: Thu, 23 Apr 1998 17:09:40 -0400 (EDT) Cc: hannu@trust.ee, byronn@insightdist.com, pgsql-hackers@postgreSQL.org, pgsql-interfaces@postgreSQL.org In-Reply-To: <353F96B3.E75DB188@insightdist.com> from "David Hartwig" at Apr 23, 98 03:29:55 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > > 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? Hmm. The problem is that many of us use the old 'text' type, which doesn't have a defined length. Not sure how to handle this in a portable libpq way? -- Bruce Momjian | 830 Blythe Avenue maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026 + If your life is a hard drive, | (610) 353-9879(w) + Christ can be your backup. | (610) 853-3000(h)