X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF12053234 for ; Sun, 3 Apr 2005 02:56:23 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39440-10 for ; Sun, 3 Apr 2005 01:56:20 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 0EF59538AF for ; Sun, 3 Apr 2005 02:56:19 +0100 (BST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j331uDVB007356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 2 Apr 2005 18:56:16 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j331uDhr029739; Sat, 2 Apr 2005 18:56:13 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j331uDgA029738; Sat, 2 Apr 2005 18:56:13 -0700 (MST) (envelope-from mfuhr) Date: Sat, 2 Apr 2005 18:56:13 -0700 From: Michael Fuhr To: Jerry Day Cc: "'pgsql-interfaces@postgresql.org'" Subject: Re: Problems with PQfmod() returning -1 on varchar field (libpq-8.0.0 )? Message-ID: <20050403015613.GA29651@winnie.fuhr.org> References: <491DC5F3D279CD4EB4B157DDD62237F406ABE858@zipwire.esri.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <491DC5F3D279CD4EB4B157DDD62237F406ABE858@zipwire.esri.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/11 X-Sequence-Number: 5427 On Fri, Apr 01, 2005 at 04:21:03PM -0800, Jerry Day wrote: > > I've recently encountered a situation where PQfmod() fails to return the > defined length of a varchar field referenced in a query, as expected - > returning no information (-1), instead. Has anyone else encountered this > issue? If so, why does this occur? Can you recommended a method to more > reliably obtain the length of varchar fields, as defined in the relations > referenced by a query? Are you sure the column has a length specifier? What does "\d tablename" show, or what's the result of the following query? SELECT attname, attnum, atttypid::regtype, atttypmod FROM pg_attribute WHERE attrelid = 'tablename'::regclass AND attnum >= 1 AND attisdropped IS FALSE ORDER by attnum; -- Michael Fuhr http://www.fuhr.org/~mfuhr/