Received: from access1.digex.net (qlVJj5dikdHoM@access1.digex.net [205.197.245.192]) by hub.org (8.9.1/8.9.1) with ESMTP id UAA02733 for ; Tue, 10 Nov 1998 20:34:55 -0500 (EST) (envelope-from cobrien@access.digex.net) Received: (from cobrien@localhost) by access1.digex.net (8.8.4/8.8.4) id UAA07958; Tue, 10 Nov 1998 20:34:47 -0500 (EST) From: "Cary B. O'Brien" Message-Id: <199811110134.UAA07958@access1.digex.net> Subject: Re: [INTERFACES] how to obtain column info To: ken@ori-ind.com (Ken J. Wright) Date: Tue, 10 Nov 1998 20:34:47 -0500 (EST) Cc: pgsql-interfaces@postgreSQL.org In-Reply-To: <3.0.1.32.19981110163802.007b72f0@ori-ind.com> from "Ken J. Wright" at "Nov 10, 98 04:38:02 pm" X-Mailer: ELM [version 2.4ME+ PL15 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > With libpq, how do you obtain column info (like type) for a table *before* > returning a result set? For instance, knowing the column type before > constructing an insert statement. A date will need quotes, a number won't, > a string will, etc. > I usually do a 'select * from table_x where oid < 0' or something like that to get an empty result set. This might be a stupid thing to do on a big table, thought. You might want to select a column with an index. Anyone have a better idea? Actually, you should be able to get the information out of the pg_ tables. -- cary