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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jerry Day <jerry_day(at)esri(dot)com>
Cc: "'Bruce Momjian'" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Problems with PQfmod() returning -1 on varchar f
Date: 2005-04-05 01:43:18
Message-ID: 4852.1112665398@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Jerry Day <jerry_day(at)esri(dot)com> writes:
> 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;

The UNION will drop the typmod, even if both its inputs have the same
typmod. See e.g.
http://archives.postgresql.org/pgsql-general/2005-04/msg00204.php

This is on the agenda to look at for 8.1 ...

regards, tom lane

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Fuhr 2005-04-05 03:39:33 Re: libpq and referencing data type OIDs
Previous Message Marvin Bellamy 2005-04-04 20:58:12 libpq and referencing data type OIDs