<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Text on BareSQL.com</title>
    <link>https://baresql.com/tags/text/</link>
    <description>Recent content in Text on BareSQL.com</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 26 Oct 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://baresql.com/tags/text/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>A Backslash in LIKE Escapes Percent and Underscore Everywhere Except SQLite</title>
      <link>https://baresql.com/a-backslash-in-like-escapes-percent-and-underscore-everywhere-except-sqlite/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/a-backslash-in-like-escapes-percent-and-underscore-everywhere-except-sqlite/</guid>
      <description>&lt;p&gt;Searching for the text 50_off with &lt;code&gt;LIKE &#39;50\_off&#39;&lt;/code&gt; works on PostgreSQL, MySQL and MariaDB, where the backslash escapes the underscore. SQLite treats the backslash as an ordinary character, and the search finds nothing.&lt;/p&gt;&#xA;&lt;p&gt;&#39;a_b&#39; LIKE &#39;a\_b&#39; is true on PostgreSQL, MySQL and MariaDB, where \_ matches an underscore, and false on SQLite, where the pattern asks for a backslash followed by any one character.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://baresql.com/images/rule-like-escape.png&#34; alt=&#34;SELECT &#39;a_b&#39; LIKE &#39;a\_b&#39;, run on four engines: SQLite 3.45.1 0; PostgreSQL 16.15 true; MySQL 8.0.46 1; MariaDB 10.11.14 1.&#34;&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>A Backslash Is an Escape Character in MySQL Strings and a Plain Character in PostgreSQL</title>
      <link>https://baresql.com/a-backslash-is-an-escape-character-in-mysql-strings-and-a-plain-character-in-postgresql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/a-backslash-is-an-escape-character-in-mysql-strings-and-a-plain-character-in-postgresql/</guid>
      <description>&lt;p&gt;A Windows path written as &lt;code&gt;&#39;C:\temp\new&#39;&lt;/code&gt; reads back on MySQL and MariaDB with a tab and a line break in it. PostgreSQL and SQLite keep the backslashes as typed.&lt;/p&gt;&#xA;&lt;p&gt;&#39;C:\\temp&#39; is C:\\temp, two backslashes, on SQLite and PostgreSQL and C:\temp on MySQL and MariaDB. &#39;\t&#39; is a tab and &#39;\&#39;&#39; a quote there, while PostgreSQL needs its E&#39;...&#39; strings for escapes, which no other engine reads. MySQL’s NO_BACKSLASH_ESCAPES mode makes it read backslashes like the others.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CAST to CHAR Cuts a Value to One Character on PostgreSQL</title>
      <link>https://baresql.com/cast-to-char-cuts-a-value-to-one-character-on-postgresql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/cast-to-char-cuts-a-value-to-one-character-on-postgresql/</guid>
      <description>&lt;p&gt;&lt;code&gt;CAST(order_id AS CHAR)&lt;/code&gt; looks like a safe way to turn a number into text. On PostgreSQL CHAR without a length means one character, so order 123 comes back as &lt;code&gt;&#39;1&#39;&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;PostgreSQL reads CHAR without a length as CHAR(1) and cuts the value to fit. With a length, CHAR(10), it pads the value with spaces. MySQL accepts CHAR in CAST but neither VARCHAR nor TEXT, and MariaDB accepts VARCHAR but not TEXT.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CHAR Columns Come Back Padded With Spaces on PostgreSQL</title>
      <link>https://baresql.com/char-columns-come-back-padded-with-spaces-on-postgresql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/char-columns-come-back-padded-with-spaces-on-postgresql/</guid>
      <description>&lt;p&gt;An order status kept in a &lt;code&gt;CHAR(10)&lt;/code&gt; column compares as expected in SQL on every engine. In the application code, though, a check for paid orders fails on PostgreSQL alone.&lt;/p&gt;&#xA;&lt;p&gt;A CHAR(5) column holding &#39;a&#39; returns &#39;a    &#39; on PostgreSQL. Comparisons there ignore the padding, so WHERE c = &#39;a&#39; still matches, but the spaces reach the application and CONCAT. MySQL and MariaDB strip trailing spaces when they read CHAR values, and SQLite does not apply the length at all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Comparing a Text Column With the Number 0 Matches Codes Like abc on MySQL and Fails on PostgreSQL</title>
      <link>https://baresql.com/comparing-a-text-column-with-the-number-0-matches-codes-like-abc-on-mysql-and-fails-on-postgresql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/comparing-a-text-column-with-the-number-0-matches-codes-like-abc-on-mysql-and-fails-on-postgresql/</guid>
      <description>&lt;p&gt;Product codes are text, and a query that forgets the quotes, &lt;code&gt;WHERE code = 0&lt;/code&gt;, still runs on MySQL and MariaDB. There it returns codes that have nothing to do with 0.&lt;/p&gt;&#xA;&lt;p&gt;MySQL and MariaDB turn the text into a number, and text that does not start with digits becomes 0, so WHERE code = 0 finds every code like &#39;abc&#39;. SQLite compares the number as text and finds nothing. PostgreSQL refuses to compare character varying with integer. &#39;1&#39; = 1 trips over the same thing in another way: false on SQLite, true on the other three.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CONCAT With a NULL Argument Returns NULL on MySQL and Skips It on PostgreSQL</title>
      <link>https://baresql.com/concat-with-a-null-argument-returns-null-on-mysql-and-skips-it-on-postgresql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/concat-with-a-null-argument-returns-null-on-mysql-and-skips-it-on-postgresql/</guid>
      <description>&lt;p&gt;A customer list built with &lt;code&gt;CONCAT(first_name, &#39; &#39;, last_name)&lt;/code&gt; looks complete on PostgreSQL and SQLite. Moved to MySQL or MariaDB, the same query returns NULL for some customers.&lt;/p&gt;&#xA;&lt;p&gt;A person without a last name comes out as &#39;Ann &#39; on SQLite and PostgreSQL and as NULL on MySQL and MariaDB, so a list of names quietly loses entries there. CONCAT_WS skips NULL arguments on all four engines.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://baresql.com/images/rule-concat-null.png&#34; alt=&#34;SELECT CONCAT(first_name, &#39; &#39;, last_name) FROM people, run on four engines: SQLite 3.45.1 &#39;Ann &#39;; PostgreSQL 16.15 &#39;Ann &#39;; MySQL 8.0.46 NULL; MariaDB 10.11.14 NULL.&#34;&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>LENGTH Counts Bytes on MySQL and MariaDB and Characters on PostgreSQL and SQLite</title>
      <link>https://baresql.com/length-counts-bytes-on-mysql-and-mariadb-and-characters-on-postgresql-and-sqlite/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/length-counts-bytes-on-mysql-and-mariadb-and-characters-on-postgresql-and-sqlite/</guid>
      <description>&lt;p&gt;A check that a name is at most 20 characters long, written with &lt;code&gt;LENGTH(name)&lt;/code&gt;, lets 20 letters through on SQLite and PostgreSQL. MySQL and MariaDB count bytes instead, so a name with accents reaches the limit sooner.&lt;/p&gt;&#xA;&lt;p&gt;In UTF-8 a letter outside A to Z takes two to four bytes. MySQL and MariaDB count characters with CHAR_LENGTH, which SQLite lacks. Length checks and cut-offs drift apart on names and addresses with accents.&lt;/p&gt;</description>
    </item>
    <item>
      <title>LIKE Ignores Letter Case on SQLite and MySQL and Respects It on PostgreSQL</title>
      <link>https://baresql.com/like-ignores-letter-case-on-sqlite-and-mysql-and-respects-it-on-postgresql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/like-ignores-letter-case-on-sqlite-and-mysql-and-respects-it-on-postgresql/</guid>
      <description>&lt;p&gt;A search box that runs &lt;code&gt;WHERE name LIKE &#39;ann%&#39;&lt;/code&gt; finds Ann on SQLite, MySQL and MariaDB. On PostgreSQL it misses her, because LIKE there compares letters exactly.&lt;/p&gt;&#xA;&lt;p&gt;SQLite’s LIKE ignores case for the letters A to Z only. MySQL and MariaDB follow the collation, which ignores case by default. PostgreSQL’s LIKE is exact; its ILIKE ignores case, and exists on PostgreSQL only.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://baresql.com/images/rule-like-case.png&#34; alt=&#34;SELECT &#39;abc&#39; LIKE &#39;ABC&#39;, run on four engines: SQLite 3.45.1 1; PostgreSQL 16.15 false; MySQL 8.0.46 1; MariaDB 10.11.14 1.&#34;&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>MySQL Compares Text Without Regard to Letter Case and PostgreSQL Compares It Exactly</title>
      <link>https://baresql.com/mysql-compares-text-without-regard-to-letter-case-and-postgresql-compares-it-exactly/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/mysql-compares-text-without-regard-to-letter-case-and-postgresql-compares-it-exactly/</guid>
      <description>&lt;p&gt;Sign-ups as &lt;code&gt;ann@example.com&lt;/code&gt; and &lt;code&gt;Ann@example.com&lt;/code&gt; are two users on PostgreSQL and SQLite. On MySQL and MariaDB a unique key on the email column refuses the second sign-up.&lt;/p&gt;&#xA;&lt;p&gt;The default collations of MySQL and MariaDB ignore case and accents, so &#39;abc&#39; = &#39;ABC&#39; and &#39;e&#39; = &#39;é&#39; are true there and false on SQLite and PostgreSQL. The same goes for joins, GROUP BY, DISTINCT and unique keys: two values that differ only in case count as one on MySQL and as two elsewhere. Whether an answer changes depends on the data, so lint reports this as information.&lt;/p&gt;</description>
    </item>
    <item>
      <title>SQLite LOWER and UPPER Change Only the Letters A to Z</title>
      <link>https://baresql.com/sqlite-lower-and-upper-change-only-the-letters-a-to-z/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/sqlite-lower-and-upper-change-only-the-letters-a-to-z/</guid>
      <description>&lt;p&gt;Searching names with &lt;code&gt;LOWER(name) = LOWER(&#39;Émile&#39;)&lt;/code&gt; works on PostgreSQL, MySQL and MariaDB. On SQLite, LOWER changes only A to Z, so É stays É and a stored émile never matches.&lt;/p&gt;&#xA;&lt;p&gt;SQLite folds case for ASCII letters only, and so do its LIKE and COLLATE NOCASE, unless it is built with the ICU extension, as some systems ship it. Comparisons that use LOWER() to ignore case work on the other engines and fail on SQLite for names like Émile or Ødegaard.&lt;/p&gt;</description>
    </item>
    <item>
      <title>SUBSTR From Position 0 Returns Text on SQLite and PostgreSQL and Nothing on MySQL</title>
      <link>https://baresql.com/substr-from-position-0-returns-text-on-sqlite-and-postgresql-and-nothing-on-mysql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/substr-from-position-0-returns-text-on-sqlite-and-postgresql-and-nothing-on-mysql/</guid>
      <description>&lt;p&gt;Code ported from a language that counts from 0 often ends up with &lt;code&gt;SUBSTR(code, 0, 3)&lt;/code&gt;. SQLite and PostgreSQL return the first two characters. MySQL and MariaDB return an empty string.&lt;/p&gt;&#xA;&lt;p&gt;Positions start at 1. SQLite and PostgreSQL count position 0 as part of the requested length, while MySQL and MariaDB return nothing for a start of 0. Negative starts differ as well: SQLite, MySQL and MariaDB count them from the end, and PostgreSQL counts them before the first character.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Double Pipe Operator Joins Text on PostgreSQL and SQLite and Means OR on MySQL</title>
      <link>https://baresql.com/the-double-pipe-operator-joins-text-on-postgresql-and-sqlite-and-means-or-on-mysql/</link>
      <pubDate>Mon, 26 Oct 2026 00:00:00 +0000</pubDate>
      <guid>https://baresql.com/the-double-pipe-operator-joins-text-on-postgresql-and-sqlite-and-means-or-on-mysql/</guid>
      <description>&lt;p&gt;Code that builds labels with &lt;code&gt;first_name || &#39; &#39; || last_name&lt;/code&gt; works on PostgreSQL and SQLite. Move it to MySQL or MariaDB and every label comes back as 0, with no error to say why.&lt;/p&gt;&#xA;&lt;p&gt;The SQL standard joins strings with ||, and SQLite and PostgreSQL follow it. MySQL and MariaDB read || as a logical OR unless the server runs in the PIPES_AS_CONCAT mode, so both strings are turned into numbers and the answer is 0. The warnings they give for it seldom reach the application.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
