CINXE.COM
Queries With Escape Characters: Unexpected Results - SQL++ - Couchbase Forums
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Queries With Escape Characters: Unexpected Results - SQL++ - Couchbase Forums</title> <meta name="description" content="Suppose I have a document in my database with this literal String value for a field (nothing here is an escape character; this is the final string that should appear in the UI of an app): \\\blah%%BLAH\\ I anticipated &hellip;"> <meta name="generator" content="Discourse 3.5.0.beta2-dev - https://github.com/discourse/discourse version 424da95128bd2e92c4d8e42baf65a947602e9c68"> <link rel="icon" type="image/png" href="https://global.discourse-cdn.com/couchbase/optimized/2X/5/5c3358874946bfe880e9bf3ffda96c2bc67451a6_2_32x32.png"> <link rel="apple-touch-icon" type="image/png" href="https://global.discourse-cdn.com/couchbase/optimized/2X/b/b979c51a7b008edb40f4aaf42a8b8946bc100805_2_180x180.png"> <meta name="theme-color" media="all" content="#ffffff"> <meta name="color-scheme" content="light"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, viewport-fit=cover"> <meta name="discourse-base-uri" content="/forums"> <link rel="canonical" href="https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191" /> <link rel="search" type="application/opensearchdescription+xml" href="https://www.couchbase.com/forums/opensearch.xml" title="Couchbase Forums Search"> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/color_definitions_couchbase-peach_9_5_ab174a10fb96d72c85c018c3c55c5fadf1a41613.css?__ws=www.couchbase.com" media="all" rel="stylesheet" class="light-scheme"/> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/desktop_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="desktop" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/checklist_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="checklist" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-ai_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-ai" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-akismet_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-akismet" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-algolia_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-algolia" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-cakeday_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-cakeday" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-data-explorer_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-data-explorer" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-details_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-details" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-lazy-videos_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-lazy-videos" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-local-dates_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-local-dates" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-narrative-bot_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-narrative-bot" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-policy_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-policy" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-presence_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-presence" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-solved_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-solved" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-templates_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-templates" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-topic-voting_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-topic-voting" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/footnote_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="footnote" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/hosted-site_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="hosted-site" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/poll_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="poll" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/spoiler-alert_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="spoiler-alert" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-ai_desktop_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-ai_desktop" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/discourse-topic-voting_desktop_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="discourse-topic-voting_desktop" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/poll_desktop_3af6c98092cd70834b4e7a2ee96d327d620393a4.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="poll_desktop" /> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/desktop_theme_12_72dc6d44ead417d71e88813c4d885dc97f76f44f.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="12" data-theme-name="discourse clickable topic"/> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/desktop_theme_10_5b0b1529a6a32a5aadaada5dc3d80408d1186da3.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="10" data-theme-name="modern category + group boxes"/> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/desktop_theme_5_8e99c231efb3cbea9beda8c0bb88e94287f68559.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="5" data-theme-name="mint"/> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/desktop_theme_16_f42306ced0fb3b466b05b3253dba728a5248581a.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="16" data-theme-name="couchbase 2"/> <link href="https://sea2.discourse-cdn.com/couchbase/forums/stylesheets/desktop_theme_4_6069e6e9863625ef3110ca06478152827ac5bbea.css?__ws=www.couchbase.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="4" data-theme-name="header alignment fix"/> <!-- OneTrust Cookies Consent Notice start for couchbase.com --> <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="748511ff-10bf-44bf-88b8-36382e5b5fd9" nonce="yY8V6xbdTNR1TdFr9awnospmT"></script> <!-- OneTrust Cookies Consent Notice end for couchbase.com --><script defer="" src="https://sea2.discourse-cdn.com/couchbase/forums/theme-javascripts/87b4efff34091d9be9e0da05837c945fe6220398.js?__ws=www.couchbase.com" data-theme-id="17" nonce="yY8V6xbdTNR1TdFr9awnospmT"></script> <link rel="alternate nofollow" type="application/rss+xml" title="RSS feed of 'Queries With Escape Characters: Unexpected Results'" href="https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191.rss" /> <meta property="og:site_name" content="Couchbase Forums" /> <meta property="og:type" content="website" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:image" content="https://global.discourse-cdn.com/couchbase/original/2X/0/01f9ae109c030e7bf64d0812eaa8a3b08cf5ce60.png" /> <meta property="og:image" content="https://global.discourse-cdn.com/couchbase/original/2X/3/3d0d79fb182d067253be4666da0e1ec321b9536b.svg" /> <meta property="og:url" content="https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191" /> <meta name="twitter:url" content="https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191" /> <meta property="og:title" content="Queries With Escape Characters: Unexpected Results" /> <meta name="twitter:title" content="Queries With Escape Characters: Unexpected Results" /> <meta property="og:description" content="Suppose I have a document in my database with this literal String value for a field (nothing here is an escape character; this is the final string that should appear in the UI of an app): \\\blah%%BLAH\\ I anticipated this query would work: SELECT *, Meta().id FROM SomeCollection WHERE (LOWER(`title`) LIKE "\\\\\\blah\%\%blah\\\\") But I get syntax error: invalid quoted string - invalid escape sequence - line 1, column 63, which is the leading ". I figured the query engine might be getting ..." /> <meta name="twitter:description" content="Suppose I have a document in my database with this literal String value for a field (nothing here is an escape character; this is the final string that should appear in the UI of an app): \\\blah%%BLAH\\ I anticipated this query would work: SELECT *, Meta().id FROM SomeCollection WHERE (LOWER(`title`) LIKE "\\\\\\blah\%\%blah\\\\") But I get syntax error: invalid quoted string - invalid escape sequence - line 1, column 63, which is the leading ". I figured the query engine might be getting ..." /> <meta property="og:article:section" content="SQL++" /> <meta property="og:article:section:color" content="C71A25" /> <meta property="og:article:tag" content="query" /> <meta property="og:article:tag" content="swift" /> <meta name="twitter:label1" value="Reading time" /> <meta name="twitter:data1" value="1 mins 🕑" /> <meta name="twitter:label2" value="Likes" /> <meta name="twitter:data2" value="2 ❤" /> <meta property="article:published_time" content="2025-02-15T07:23:38+00:00" /> <meta property="og:ignore_canonical" content="true" /> <script type="application/ld+json">{"@context":"http://schema.org","@type":"QAPage","name":"Queries With Escape Characters: Unexpected Results","mainEntity":{"@type":"Question","name":"Queries With Escape Characters: Unexpected Results","text":"Suppose I have a document in my database with this literal String value for a field (nothing here is an escape character; this is the final string that should appear in the UI of an app):\n\n\\\\\\blah%%BLAH\\\\\n\nI anticipated this query would work:\n\nSELECT *, Meta().id FROM SomeCollection WHERE (LOWER(`ti…","upvoteCount":1,"answerCount":1,"datePublished":"2025-02-15T07:23:38.908Z","author":{"@type":"Person","name":"bdkjones","url":"https://www.couchbase.com/forums/u/bdkjones"},"acceptedAnswer":{"@type":"Answer","text":"<a name=\"p-120393-i-need-a-new-backslash-key-1\" class=\"anchor\" href=\"#p-120393-i-need-a-new-backslash-key-1\"><\/a>I Need a New Backslash Key\n\nSo the backslashes need to be double-escaped as well. Which means to match a single backslash, you must use four of them in the query. Here’s what ended up working\n\nNeedle: \\\\\\blah%%BLAH\\\\\n\nQuery: SELECT *, Meta().id FROM Foo WHERE (LOWER(title) LIKE "\\\\\\\\\\\\\\\\\\\\\\\\blah\\\\%\\\\…","upvoteCount":1,"datePublished":"2025-02-15T08:09:14.357Z","url":"https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191/3","author":{"@type":"Person","name":"bdkjones","url":"https://www.couchbase.com/forums/u/bdkjones"}}}}</script> </head> <body class="crawler browser-update"> <header> <a href="/forums/"> Couchbase Forums </a> </header> <div id="main-outlet" class="wrap" role="main"> <div id="topic-title"> <h1> <a href="/forums/t/queries-with-escape-characters-unexpected-results/40191">Queries With Escape Characters: Unexpected Results</a> </h1> <div class="topic-category" itemscope itemtype="http://schema.org/BreadcrumbList"> <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a href="/forums/c/sql/16" class="badge-wrapper bullet" itemprop="item"> <span class='badge-category-bg' style='background-color: #C71A25'></span> <span class='badge-category clear-badge'> <span class='category-name' itemprop='name'>SQL++</span> </span> </a> <meta itemprop="position" content="1" /> </span> </div> <div class="topic-category"> <div class='discourse-tags list-tags'> <a href='https://www.couchbase.com/forums/tag/query' class='discourse-tag' rel="tag">query</a>, <a href='https://www.couchbase.com/forums/tag/swift' class='discourse-tag' rel="tag">swift</a> </div> </div> </div> <div itemscope itemtype='http://schema.org/DiscussionForumPosting'> <meta itemprop='headline' content='Queries With Escape Characters: Unexpected Results'> <link itemprop='url' href='https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191'> <meta itemprop='datePublished' content='2025-02-15T07:23:38Z'> <meta itemprop='articleSection' content='SQL++'> <meta itemprop='keywords' content='query, swift'> <div itemprop='publisher' itemscope itemtype="http://schema.org/Organization"> <meta itemprop='name' content='Couchbase Forums'> <div itemprop='logo' itemscope itemtype="http://schema.org/ImageObject"> <meta itemprop='url' content='https://global.discourse-cdn.com/couchbase/original/2X/0/01f9ae109c030e7bf64d0812eaa8a3b08cf5ce60.png'> </div> </div> <div id='post_1' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://www.couchbase.com/forums/u/bdkjones'><span itemprop='name'>bdkjones</span></a> </span> <link itemprop="mainEntityOfPage" href="https://www.couchbase.com/forums/t/queries-with-escape-characters-unexpected-results/40191"> <span class="crawler-post-infos"> <time datetime='2025-02-15T07:23:38Z' class='post-time'> February 15, 2025, 7:23am </time> <meta itemprop='dateModified' content='2025-02-15T07:26:49Z'> <span itemprop='position'>1</span> </span> </div> <div class='post' itemprop='text'> <p>Suppose I have a document in my database with this literal String value for a field (nothing here is an escape character; this is the final string that should appear in the UI of an app):</p> <pre><code class="lang-auto">\\\blah%%BLAH\\ </code></pre> <p>I anticipated this query would work:</p> <pre><code class="lang-auto">SELECT *, Meta().id FROM SomeCollection WHERE (LOWER(`title`) LIKE "\\\\\\blah\%\%blah\\\\") </code></pre> <p>But I get <code>syntax error: invalid quoted string - invalid escape sequence - line 1, column 63</code>, which is the leading <code>"</code>.</p> <p>I figured the query engine might be getting tripped up by the closing <code>\"</code>, so I switched to single quotes. But that gives: <code>syntax error: invalid quoted string - invalid escape sequence - line 1, column 71</code>, which is just after the first “b” in “blah”.</p> <p>All of these tests are done in Capella’s web UI query interface. So what’s the correct way to escape in a situation like this?</p> <p>NB: I’m not concerned with performance or alternate approaches for this exact query. This is a test case specifically designed to exercise escapes.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="1" /> <span class='post-likes'>1 Like</span> </div> </div> <div id='post_2' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://www.couchbase.com/forums/u/bdkjones'><span itemprop='name'>bdkjones</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2025-02-15T07:52:36Z' class='post-time'> February 15, 2025, 7:52am </time> <meta itemprop='dateModified' content='2025-02-15T07:52:36Z'> <span itemprop='position'>2</span> </span> </div> <div class='post' itemprop='text'> <h2><a name="p-120392-update-1" class="anchor" href="#p-120392-update-1"></a>Update</h2> <p>I found <a href="https://www.couchbase.com/forums/t/escaping-wildcards-in-like/11772/2">an old thread</a> and made some progress. It turns out that the <code>%</code> wildcards must be <em>double-escaped</em>. So I’ve now got this working:</p> <pre><code class="lang-auto">SELECT *, Meta().id FROM SomeCollection WHERE (LOWER(`title`) LIKE "\\\\\\blah\\%\\%blah") </code></pre> <p>But if the string I want to match <em>ends</em> with a backslash, I have a new error:</p> <pre><code class="lang-auto">//Error evaluating filter - cause: Trailing escape character (\\) in pattern SELECT *, Meta().id FROM SomeCollection WHERE (LOWER(`title`) LIKE "\\\\\\blah\\%\\%blah\\") </code></pre> <p>I haven’t been able to resolve this yet. Single/Double quotes don’t matter.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_3' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://www.couchbase.com/forums/u/bdkjones'><span itemprop='name'>bdkjones</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2025-02-15T08:09:14Z' class='post-time'> February 15, 2025, 8:09am </time> <meta itemprop='dateModified' content='2025-02-15T08:09:14Z'> <span itemprop='position'>3</span> </span> </div> <div class='post' itemprop='text'> <h1><a name="p-120393-i-need-a-new-backslash-key-1" class="anchor" href="#p-120393-i-need-a-new-backslash-key-1"></a>I Need a New Backslash Key</h1> <p>So the backslashes need to be double-escaped as well. Which means to match a single backslash, you must use <em>four</em> of them in the query. Here’s what ended up working</p> <p>Needle: <code>\\\blah%%BLAH\\</code></p> <p>Query: <code>SELECT *, Meta().id FROM Foo WHERE (LOWER(</code>title<code>) LIKE "\\\\\\\\\\\\blah\\%\\%blah\\\\\\\\")</code></p> <h1><a name="p-120393-a-smaller-example-2" class="anchor" href="#p-120393-a-smaller-example-2"></a>A Smaller Example</h1> <p>Suppose we want to find this needle: <code>blah\blah</code>. In the JSON document, that has be represented with the backslash escaped: <code>blah\\blah</code>.</p> <p>It looks like the query engine is targeting the JSON value rather than what the string <em>actually</em> is when the JSON value is parsed and the escapes are removed.</p> <p>Because this query matches nothing:</p> <pre><code class="lang-auto">SELECT *, Meta().id FROM Foo WHERE (LOWER(`title`) LIKE "blah\\blah") </code></pre> <p>But this query matches the <code>blah\blah</code> needle:</p> <pre><code class="lang-auto">SELECT *, Meta().id FROM Foo WHERE (LOWER(`title`) LIKE "blah\\\\blah") </code></pre> <h2><a name="p-120393-a-suggestion-3" class="anchor" href="#p-120393-a-suggestion-3"></a>A suggestion</h2> <p>It would be helpful for the docs to clarify this. You’re querying against the already-escaped string that’s in JSON, not the “original” or “raw” string that you stored. This matters because applications using the SDKs will have the string <code>blah\blah</code> and if you think you just have to escape that backslash once, your query isn’t looking for what you think it’s looking for.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="1" /> <span class='post-likes'>1 Like</span> </div> </div> <div id='post_4' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://www.couchbase.com/forums/u/vsr1'><span itemprop='name'>vsr1</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2025-02-17T23:18:02Z' class='post-time'> February 17, 2025, 11:18pm </time> <meta itemprop='dateModified' content='2025-02-17T23:18:02Z'> <span itemprop='position'>4</span> </span> </div> <div class='post' itemprop='text'> <p>FYI:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/comparisonops.html#like"> <header class="source"> <img src="https://docs.couchbase.com/_/img/favicon.svg" class="site-icon" width="16" height="16"> <a href="https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/comparisonops.html#like" target="_blank" rel="noopener">docs.couchbase.com</a> </header> <article class="onebox-body"> <h3><a href="https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/comparisonops.html#like" target="_blank" rel="noopener">Comparison Operators | Couchbase Docs</a></h3> <p>Comparison operators enable you to compare expressions.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> </div> <div id="related-topics" class="more-topics__list " role="complementary" aria-labelledby="related-topics-title"> <h3 id="related-topics-title" class="more-topics__list-title"> Related topics </h3> <div class="topic-list-container" itemscope itemtype='http://schema.org/ItemList'> <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'> <table class='topic-list'> <thead> <tr> <th>Topic</th> <th></th> <th class="replies">Replies</th> <th class="views">Views</th> <th>Activity</th> </tr> </thead> <tbody> <tr class="topic-list-item" id="topic-list-item-17234"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='1'> <span class="link-top-line"> <a itemprop='url' href='https://www.couchbase.com/forums/t/contains-and-escaped-characters/17234' class='title raw-link raw-topic-link'>CONTAINS and escaped characters?</a> </span> <div class="link-bottom-line"> <a href='/forums/c/sql/16' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #C71A25'></span> <span class='badge-category clear-badge'> <span class='category-name'>SQL++</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>2</span> </td> <td class="views"> <span class='views' title='views'>2218</span> </td> <td> June 19, 2018 </td> </tr> <tr class="topic-list-item" id="topic-list-item-31214"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='2'> <span class="link-top-line"> <a itemprop='url' href='https://www.couchbase.com/forums/t/select-returns-incorrect-results-with-underscore-in-where-clause/31214' class='title raw-link raw-topic-link'>SELECT returns incorrect results with underscore in WHERE clause</a> </span> <div class="link-bottom-line"> <a href='/forums/c/sql/16' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #C71A25'></span> <span class='badge-category clear-badge'> <span class='category-name'>SQL++</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>3</span> </td> <td class="views"> <span class='views' title='views'>752</span> </td> <td> July 22, 2021 </td> </tr> <tr class="topic-list-item" id="topic-list-item-21496"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='3'> <span class="link-top-line"> <a itemprop='url' href='https://www.couchbase.com/forums/t/backward-slash-not-getting-escaped/21496' class='title raw-link raw-topic-link'>Backward slash not getting ESCAPED</a> </span> <div class="link-bottom-line"> <a href='/forums/c/sql/16' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #C71A25'></span> <span class='badge-category clear-badge'> <span class='category-name'>SQL++</span> </span> </a> <div class="discourse-tags"> <a href='https://www.couchbase.com/forums/tag/query' class='discourse-tag'>query</a> , <a href='https://www.couchbase.com/forums/tag/n1ql' class='discourse-tag'>n1ql</a> , <a href='https://www.couchbase.com/forums/tag/server' class='discourse-tag'>server</a> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>3</span> </td> <td class="views"> <span class='views' title='views'>1630</span> </td> <td> May 19, 2019 </td> </tr> <tr class="topic-list-item" id="topic-list-item-11772"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='4'> <span class="link-top-line"> <a itemprop='url' href='https://www.couchbase.com/forums/t/escaping-wildcards-in-like/11772' class='title raw-link raw-topic-link'>Escaping wildcards in LIKE</a> </span> <div class="link-bottom-line"> <a href='/forums/c/couchbase-server/15' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #EC1E2C'></span> <span class='badge-category clear-badge'> <span class='category-name'>Couchbase Server</span> </span> </a> <div class="discourse-tags"> <a href='https://www.couchbase.com/forums/tag/n1ql' class='discourse-tag'>n1ql</a> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>3</span> </td> <td class="views"> <span class='views' title='views'>2815</span> </td> <td> February 16, 2017 </td> </tr> <tr class="topic-list-item" id="topic-list-item-26152"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='5'> <span class="link-top-line"> <a itemprop='url' href='https://www.couchbase.com/forums/t/select-where-name-with-in-name/26152' class='title raw-link raw-topic-link'>Select where name with \' in name</a> </span> <div class="link-bottom-line"> <a href='/forums/c/sql/16' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #C71A25'></span> <span class='badge-category clear-badge'> <span class='category-name'>SQL++</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>1</span> </td> <td class="views"> <span class='views' title='views'>811</span> </td> <td> May 28, 2020 </td> </tr> </tbody> </table> </div> </div> </div> <footer class="container wrap"> <nav class='crawler-nav'> <ul> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/forums/' itemprop="url">Home </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/forums/categories' itemprop="url">Categories </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/forums/guidelines' itemprop="url">Guidelines </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='https://www.couchbase.com/terms-of-use/' itemprop="url">Terms of Service </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='https://www.couchbase.com/privacy-policy/' itemprop="url">Privacy Policy </a> </span> </li> </ul> </nav> <p class='powered-by-link'>Powered by <a href="https://www.discourse.org">Discourse</a>, best viewed with JavaScript enabled</p> </footer> <!-- EXPORTED TAGS --> <!-- Tags for Couchbase oneTag --> <!-- One Tag Conditional Container: Couchbase (6792) | Couchbase oneTag (5045) --> <script defer="" src="https://sea2.discourse-cdn.com/couchbase/forums/theme-javascripts/34713efacfccdc324338cc33fc0190f9dbf12b74.js?__ws=www.couchbase.com" data-theme-id="16" nonce="yY8V6xbdTNR1TdFr9awnospmT"></script> <div class="buorg"><div>Unfortunately, <a href="https://www.discourse.org/faq/#browser">your browser is unsupported</a>. Please <a href="https://browsehappy.com">switch to a supported browser</a> to view rich content, log in and reply.</div></div> </body> </html>