pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Jerry Day <jerry_day@esri.com>
Cc: 'pgsql-interfaces@postgresql.org' <pgsql-interfaces@postgresql.org>
Subject: Re: Problems with PQfmod() returning -1 on varchar field (libpq-8.0.0 )?
Date: Sat, 2 Apr 2005 18:56:13 -0700
Message-ID: <20050403015613.GA29651@winnie.fuhr.org> (raw)
In-Reply-To: <491DC5F3D279CD4EB4B157DDD62237F406ABE858@zipwire.esri.com>
References: <491DC5F3D279CD4EB4B157DDD62237F406ABE858@zipwire.esri.com>

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/



view thread (7+ messages)  latest in thread

Message-ID: <20050403015613.GA29651@winnie.fuhr.org>
Permalink:  ../20050403015613.GA29651@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050403015613.GA29651@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: mike@fuhr.org, jerry_day@esri.com
  Subject: Re: Problems with PQfmod() returning -1 on varchar field (libpq-8.0.0 )?
  In-Reply-To: <20050403015613.GA29651@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox