I have this MySQL query, and it works on a MySQL database, but not on a PostgreSQL one:
select setype from _entity where id='72@78|'
Now, what exactly is '72@78|' trying to do? id is an integer field, so when the query is run on a Postgressql DB, it gives an invalid input syntax for integer: "72@78|" error.
I know that | is a bitwise OR operator, but what exactly is being ORED here? And, just as importantly, what is the @ for? I tried to look for it in the MySQL manual, but due to sub-par searching skills, I couldn’t find it.
When I run the above query on a MySQL DB, it finds data with an id value of 72,somehow, the expression evaluates to the first number.
So, what is the above query trying to do, and how do I convert it into a PostgreSQL equivalent?
Thanks for all your help, have a good day.
MySQL is converting the text string to a numeric, and ignoring anything after the first non-numeric character, therefore, it is just comparing
id = 72, which is what you are getting from the output.My guess is that PostgreSQL is trying to convert the whole string to an integer and failing because it isn’t a valid integer value.
To do the equivalent in PostgreSQL, you would need to convert the
72@78|to a simple integer before running your query.