r/SQL • u/Harshita_Netla • Oct 03 '26
Oracle What’s a SQL feature that works differently across PostgreSQL, MySQL, and SQL Server that tripped you up?
For those who have worked with PostgreSQL, MySQL, and SQL Server, what’s a feature or behavior that surprised you because it worked differently between them?
It could be anything like date functions, string handling, LIMIT/TOP, NULL behavior, JSON, window functions, or even error handling.
What difference caused you the most trouble, and how did you learn to handle these database-specific differences?
24
Upvotes
26
u/UniForceMusic Oct 03 '26
Wether the LIKE operator is case insensitive or not.
MySQL/MariaDB: not case sensitive by default. Use LIKE BINARY for case sensitive.
Postgres: case sensitive by default. Use ILIKE for case insensitivity.
SQLite: not case sensitive. Can be enabled using PRAGMA case_sensitive_like
Most ORMs and abstraction layers handle this for you, but when working with raw SQL you need to watch out for it
12
u/Outrageous_Let5743 Oct 03 '26
I hate TOP and i prefer limit. Same for cast when :: also exists
I believe there are sql databases where JOIN is the same as LEFT JOIN ,instead of INNER JOIN, so always write INNER JOIN.
distinct on is also a nice one instead of a row number.
5
u/NekkidWire Oct 03 '26
I hate MySQL backticks and SQL Server's (lovemaking) brackets for table/column names.
SQL standard is double quotes, it's not that hard ffs.
4
u/Plane_Big_5912 Oct 03 '26
on the mssql side the usual fix is dropping the unique constraint and using a filtered unique index instead, where col is not null. postgres 15+ can go the other way if you actually want one null, unique nulls not distinct
4
u/nl_dhh Oct 03 '26
In SQLite, data types are not enforced, so you can store text values in a numerical column... Real fun if you're not aware of that and want to migrate data to SQL Server.
4
u/Angriestanteater Oct 03 '26
Whenever I work with people who are new to Postgres, they think I’m an idiot for using varchar without a size limit. Postgres doesn’t preallocate and reserve memory for every varchar value.
3
u/AntLost4161 Oct 03 '26
I started with SQL and SQLite. In Postgres, you must have everything non aggregated in the GROUP BY clause, but that's not the case in the others, so I still sometimes mess that up. Another is just how much more fiddly it feels to work with dates in Postgres and the difference in functions between every single syntax
3
u/Significant_Tune9219 Oct 03 '26
NULL and date arithmetic are two of the biggest portability traps for me. Even when the function names match, implicit casts, time-zone handling, and whether an interval stays in calendar units can change the result; I try to make those casts explicit and test boundary dates. For pagination, I also avoid relying on engine-specific LIMIT/TOP syntax and define a stable ORDER BY, otherwise the same query can return different rows between runs.
2
u/zbignew Oct 03 '26
If you’re including MySQL, isn’t it basically everything? Default types, default nullable, limited surrogate key types.
I know MySQL has advantages, but they’re all advantages that you get even better from NoSQL. Yes, you can quickly create a table that will hold whatever garbage was provided in your web app.
2
u/RoomyRoots Oct 03 '26
Pivoting.
Why the fuck PostgreSQL haven't got an PIVOT or UNPIVOT yet?
2
u/piercesdesigns Oct 03 '26
Postgres allows rollback on table drops and mods. That was a nice feature.
Case sensitivity is always a big issue and database dependent. (Or collation setting dependent)
2
u/Legitimate-Loss-6805 Oct 03 '26
That Oracle treats empty Strings as `NULL`, while PostgreSQL does is right. 😜
2
u/Aggressive_Ad_5454 Oct 03 '26 edited Oct 03 '26
The date / time functions and data storage in the software packages you mention are different. This is a big nuisance for those who write portable SQL.
Timezone handling is idiopathic.
Full-text searching varies between the packages. The only reasonably useful full-text searching on offer is in PostgreSQL, with GIN indexes.
All except PostgreSQL use clustered indexes on the primary key to handle the storage of table data. So query optimization work has to take that into account.
MySQL (and MariaDB) have superior support for character set and collation handling. A column can be declared with a case- and diacritic- independent collation if that's what the application needs, or case-independent but diacritic-dependent, or suitable for Spanish (where ñ comes after n), or for other languages (where ñ and n are collated together). There are many other collation features here, as the implementation matches the Unicode standards.
MySQL and MariaDB have limits on the length of indexes on character columns. They work around this with an abomination known as prefix indexing.
2
u/arwinda Oct 03 '26
Half the list doesn't support DDL in transactions. Trips me every time I am trying to write a simple migration.
1
u/ZeppelinJ0 Oct 03 '26
Isn't this really just ANSI vs non ANSI?
1
u/Arkanejl Oct 03 '26
Row_Number() in SQL Server Vs Oracle (and possibly others).
In the event of a tie, Oracle will consistently choose the same row ordering whereas in SQL Server the ordering can vary.
1
u/Yellowcat123567 Oct 04 '26
UPDATE SET WHERE LIMIT
I love being able to slap a LIMIT on update/delete statements. Its extremely annoying that Postgres does not support this for production safety.
1
u/EffectivePension6711 Oct 05 '26
string case sensitivity. Migrating an app from mysql or mariadb to postgres is pure nightmare fuel because of this. in mysql,
'Admin' = 'admin'evaluates to true by default because of the default collation. You move the database to postgres and suddenly half your users can't log in because postgres is strictly case-sensitive. you either end up wrapping every single query inlower()or polluting your backend withILIKEeverywhere. It's the dumbest thing to spend a weekend debugging.7
u/[deleted] Oct 03 '26
[removed] — view removed comment