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 524C3534A4 for ; Mon, 4 Apr 2005 18:54:35 +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 05888-06 for ; Mon, 4 Apr 2005 17:54:25 +0000 (GMT) Received: from esri3.esri.com (esrismtp2.esri.com [198.102.62.103]) by svr1.postgresql.org (Postfix) with ESMTP id 04D7A5294C for ; Mon, 4 Apr 2005 18:54:24 +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 j34HsG310665; Mon, 4 Apr 2005 10:54:16 -0700 (PDT) Received: by zipwire.esri.com with Internet Mail Service (5.5.2657.72) id ; Mon, 4 Apr 2005 10:54:17 -0700 Message-ID: <491DC5F3D279CD4EB4B157DDD62237F406ABE859@zipwire.esri.com> From: Jerry Day To: "'Bruce Momjian'" , Jerry Day Cc: "'pgsql-interfaces@postgresql.org'" Subject: Re: Problems with PQfmod() returning -1 on varchar f Date: Mon, 4 Apr 2005 10:54:15 -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/17 X-Sequence-Number: 5433 Bruce, Thanks for your quick response. The column in question is defined as 'DATA VARCHAR(20) NOT NULL'. The issue occurs when this is referenced in a fairly complex query, such as: SELECT data,int16_col,int64_col,float32_col,float64_col, date_col,row_id FROM (SELECT b.data,b.int16_col,b.int64_col, b.float3_col,b.float64_col,b.date_col,b.row_id FROM table1 b LEFT JOIN (SELECT * FROM table3 ) d ON b.ROW_ID = d.ROW_ID WHERE d.ROW_ID IS NULL UNION ALL SELECT a.data,a.int16_col,a.int64_col,a.float32_col, a.float6_col,a.date_col,a.row_id FROM table2 a LEFT JOIN (SELECT * FROM table3 ) d ON (a.ROW_ID = d.ROW_ID) WHERE d.ROW_ID IS NULL ) V__282 LIMIT 0; Where: CREATE TABLE table1 ( data varchar(20) NOT NULL, int16_col int2, int64_col int8, float32_col float4, float64_col float8, date_col timestamp, row_id int4 NOT NULL, CONSTRAINT table1_pk PRIMARY KEY (row_id) ) WITHOUT OIDS; CREATE TABLE table2 ( data varchar(20) NOT NULL, int16_col int2, int64_col int8, float32_col float4, float64_col float8, date_col timestamp, row_id int4 NOT NULL, CONSTRAINT table2_pk PRIMARY KEY (row_id) ) WITHOUT OIDS; CREATE TABLE table3 ( row_id int8 NOT NULL, int32_col int4 NOT NULL, int64_col int8 NOT NULL, CONSTRAINT table3_pk PRIMARY KEY (row_id) ) WITHOUT OIDS; In this particular case, I can go back and describe each of the referenced tables, but there are other times in our application where this is not practical. Can you recommend a more reliable method to describe such queries? Is this a current limitation in Postgres which may be addressed at a future release? Thanks, Jerry _|_| _|_| ESRI Jerry L. Day Software Developer (909)793-2853 Ext. 1477 jerry_day@esri.com -----Original Message----- From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] Sent: Saturday, April 02, 2005 5:27 PM To: Jerry Day Cc: 'pgsql-interfaces@postgresql.org' Subject: Re: [INTERFACES] Problems with PQfmod() returning -1 on varchar field (libpq-8.0.0 )? Jerry Day wrote: > Hi all, > > 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? Can we see the query? I suspect the column is being manipulated in some way and the length isn't carried through to the query output --- if so, there might not be much we can do about it. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073