Home > Archive > PostgreSQL Interfaces > April 2005 > Re: Problems with PQfmod() returning -1 on varchar f









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Problems with PQfmod() returning -1 on varchar f
Jerry Day

2005-04-04, 8:04 pm

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@postgresq
l.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'::regclas
s
AND attnum >= 1
AND attisdropped IS FALSE
ORDER by attnum;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com