Order of operations in postgreSQL. - Mailing list pgsql-bugs

From Ken McClaren
Subject Order of operations in postgreSQL.
Date
Msg-id SJ0PR04MB7599D1DD3E866CF2D2F42012F9489@SJ0PR04MB7599.namprd04.prod.outlook.com
Whole thread Raw
Responses RE: Order of operations in postgreSQL.  ("Wetmore, Matthew (CTR)" <Matthew.Wetmore@express-scripts.com>)
List 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

Ken McClaren
Database Administrator

 

864.313.5997

Easley, SC

Instagram | LinkedIn | Facebook | Twitter

kipuhealth.com 

 

 

 

Attachment

pgsql-bugs by date:

Previous
From: Alexander Lakhin
Date:
Subject: Re: BUG #17888: Incorrect memory access in gist__int_ops for an input array with many elements
Next
From: "Wetmore, Matthew (CTR)"
Date:
Subject: RE: Order of operations in postgreSQL.