Order of operations in postgreSQL.

From: "Ken McClaren" <ken(dot)mcclaren(at)kipuhealth(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: John Hall <john(dot)hall(at)kipuhealth(dot)com>
Subject: Order of operations in postgreSQL.
Date: 2023-05-31 17:49:11
Message-ID: SJ0PR04MB7599D1DD3E866CF2D2F42012F9489@SJ0PR04MB7599.namprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

https://stackoverflow.com/questions/76339408/gracefully-handle-datatime-in-postgresql/76345292?noredirect=1#comment134659364_76345292

Just a few notes on this issue:

PSQL:
Appears to be applying the filter to all the columns in the table after the join.

TSQL:
Tried to duplicate this behavior and got these results.

select t1.id as t1id,
cast(cast(t1.test_value as varchar(max)) as datetime) as tms
from table1 t1
join table2 t2
on t1.id = t2.id
where cast(cast(t1.test_value as varchar(max)) as datetime) > '2023-05-27'

These statements work as expected in SQL Server.

Let me know if you have any questions.

[Logo Description automatically generated]<http://kipuhealth.com/>
Ken McClaren
Database Administrator

864.313.5997
Easley, SC
Instagram<https://www.instagram.com/kipuhealth/> | LinkedIn<https://www.linkedin.com/company/kipuhealth> | Facebook<https://www.facebook.com/KipuSystems/> | Twitter<https://twitter.com/kipuhealth>
kipuhealth.com <http://kipuhealth.com/>

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Wetmore, Matthew (CTR) 2023-05-31 20:41:50 RE: Order of operations in postgreSQL.
Previous Message Alexander Lakhin 2023-05-31 06:00:00 Re: BUG #17888: Incorrect memory access in gist__int_ops for an input array with many elements