Re: Problems with PQfmod() returning -1 on varchar f - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: Problems with PQfmod() returning -1 on varchar f
Date
Msg-id 4852.1112665398@sss.pgh.pa.us
Whole thread Raw
In response to Re: Problems with PQfmod() returning -1 on varchar f  (Jerry Day <jerry_day@esri.com>)
Responses Re: Problems with PQfmod() returning -1 on varchar f
List pgsql-interfaces
Jerry Day <jerry_day@esri.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


pgsql-interfaces by date:

Previous
From: Marvin Bellamy
Date:
Subject: libpq and referencing data type OIDs
Next
From: Michael Fuhr
Date:
Subject: Re: libpq and referencing data type OIDs