Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
PostgreSQL String, Regex and Formatting Functions: concat_ws, format(), split_part, regexp_replace, to_char and ICU Collations
In PostgreSQL, || loses the whole string because of one NULL, while concat_ws skips it; in dynamic SQL, values go in with USING and table or column names with format('%I'). split_part, substring, translate, the regexp_* functions, Turkish number formats with to_char/to_number, initcap and ILIKE with the ICU tr-TR collation, text_pattern_ops for LIKE prefix searches and pg_trgm for ILIKE '%x%', with ISBN validation and slug generation on Bookstore.
T-SQL String Functions: LEN vs DATALENGTH, CHARINDEX, SUBSTRING, REPLACE, STUFF, TRANSLATE, CONCAT_WS, STRING_AGG and STRING_SPLIT
T-SQL's string functions follow the collation, treat NULL differently and behave quietly at the edges: in a case-insensitive database REPLACE also replaces uppercase letters, and a missing N prefix turns 'İ' into 'I'. With real output and PostgreSQL counterparts we cover CHARINDEX, STUFF, TRANSLATE, QUOTENAME, the empty-string trap of CONCAT_WS with STRING_AGG, the 8000-byte error and STRING_SPLIT ordering.