Starting from question : [https://stackoverflow.com/questions/78580133/which-query-is-executed-when-var-dumppg-fetch-allpg-query-paramsdb-select][1] and the last answer to it naturally arises the question what is the result of "select cast(2.000 as varchar);" ( don’t execute it before answering on your own). Where in the docs is it explained ?
To me the result is unexpected !!!
Answer without executing the statement, so we can check what is the "feeling" of people!
2
Answers
From the manual:
It’s a postgres-style of casting, and it is mentioned in their docs:
https://www.postgresql.org/docs/7.3/sql-syntax.html
Without executing the query you posted, I’d expect the double
2.000
to be converted to a string… which has serious implications because"2.000" > "10" === true
.EDIT: the above link points to an old version of postgres, but it’s still valid and it is what came up when I did a quick google search. Here is the link to the latest docs, the same syntax is still documented:
https://www.postgresql.org/docs/current/sql-expressions.html