title: Check if key exists deep inside jsonb object in PostgreSQL v9.5+
body: <p>I have a simple query to check of the existence of the key inside jsonb object</p>
  
  <pre><code>SELECT data-&gt;$1 jdata FROM "my-scheme"."my-table"
  </code></pre>
  
  <p>I've run into 2 proplems with this query:</p>
  
  <p>1) It works fine if I pass <code>'foo'</code> as <code>$1</code> but fails with <code>"'foo'"</code> and <code>"'foo'-&gt;'bar'"</code>. So that I don't know how to reach deep keys. I use <code>node-postgres</code></p>
  
  <p>2) I only want to check if the key exists rather then fetch all data by that key.</p>
  
  <p>So the question is: How I can check if the key exists deep inside jsonb object without fetching all the data by that key?</p>