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 DA6BE5334B for ; Mon, 4 Apr 2005 19:01:06 +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 08342-01 for ; Mon, 4 Apr 2005 18:01:00 +0000 (GMT) Received: from esri3.esri.com (esrismtp2.esri.com [198.102.62.103]) by svr1.postgresql.org (Postfix) with ESMTP id EDBDD52AA8 for ; Mon, 4 Apr 2005 19:00:59 +0100 (BST) Received: from zipwire.esri.com (zipwire.esri.com [10.48.4.9]) by esri3.esri.com (8.11.6+Sun/8.11.6) with ESMTP id j34I0u312759; Mon, 4 Apr 2005 11:00:56 -0700 (PDT) Received: by zipwire.esri.com with Internet Mail Service (5.5.2657.72) id ; Mon, 4 Apr 2005 11:00:57 -0700 Message-ID: <491DC5F3D279CD4EB4B157DDD62237F406ABE85A@zipwire.esri.com> From: Jerry Day To: "'Michael Fuhr'" , Jerry Day Cc: "'pgsql-interfaces@postgresql.org'" Subject: Re: Problems with PQfmod() returning -1 on varchar f Date: Mon, 4 Apr 2005 11:00:56 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/18 X-Sequence-Number: 5434 Michael, The relevant column is defined as 'DATA VARCHAR(20) NOT NULL'. Query attname, attnum, atttypid, atttypmod returns: "data";1;"character varying";24 "int16_col";2;"smallint";-1 "int64_col";3;"bigint";-1 "float32_col";4;"real";-1 "float64_col";5;"double precision";-1 "date_col";6;"timestamp without time zone";-1 "row_id";7;"integer";-1 Thanks, Jerry _|_| _|_| ESRI Jerry L. Day Software Developer (909)793-2853 Ext. 1477 jerry_day@esri.com -----Original Message----- From: Michael Fuhr [mailto:mike@fuhr.org] Sent: Saturday, April 02, 2005 5:56 PM To: Jerry Day Cc: 'pgsql-interfaces@postgresql.org' Subject: Re: [INTERFACES] Problems with PQfmod() returning -1 on varchar field (libpq-8.0.0 )? 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/