From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Les <nagylzs(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: possible bug |
Date: | 2022-10-21 18:14:41 |
Message-ID: | 713c1a0d-f731-2a5c-433c-57f53f8443a5@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Julie Nishimura | 2022-10-21 18:51:54 | constantly updated table in Amazon RDS |
Previous Message | Adrian Klaver | 2022-10-21 18:02:20 | Re: Asking for existence of a GUI frame work similar to Oracle APEX for PostgreSQL |