Re: possible bug - Mailing list pgsql-general

From Adrian Klaver
Subject Re: possible bug
Date
Msg-id 713c1a0d-f731-2a5c-433c-57f53f8443a5@aklaver.com
Whole thread Raw
In response to Re: possible bug  (Les <nagylzs@gmail.com>)
Responses Re: possible bug
List pgsql-general
On 10/21/22 10:57 AM, Les wrote:
> One of my colleagues pointed out, that they query returns a different 
> result, if I cast the head_table_id condition to float8 and then back to 
> int8.
> 
> SELECT
> c.id <http://c.id>,
>      tt.code,
>      c.regno,
>      (
>          select count(*)
>          FROM kap.course_user cu
>          JOIN wf.workflow w_1 ON w_1.rec_id = cu.id <http://cu.id> AND 
> w_1.head_table_id::float8::int8 = 25408438504
>          where cu.is_active AND cu.course_id = c.id <http://c.id> AND 
> w_1.station_id = 25406740434
>      ) AS col_3
> FROM
>      kap.course c
>      INNER JOIN kap.training_type tt ON tt.id <http://tt.id> = 
> c.training_type_id
> where c.id <http://c.id> in (26437091668, 26643094740)
> 
> Returns:
> 
> id         |code|regno|col_3|
> -----------+----+-----+-----+
> 26437091668|TA-T| 2632|    1|
> 26643094740|PEG | 2905|    0|
> 
> Although all identifier columns are defined as int8.

So what happens if query the table directly?:

select * from wf.workflow  where head_table_id::float8::int8 = 25408438504;

vs

select * from wf.workflow  where head_table_id = 25408438504;

FYI, the convention on the list is to not top post, but instead to 
bottom or inline post. Also to trim out material which was covered in 
previous posts.



-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Asking for existence of a GUI frame work similar to Oracle APEX for PostgreSQL
Next
From: Julie Nishimura
Date:
Subject: constantly updated table in Amazon RDS