title: Check if sequence exists in Postgres (plpgsql)
body: <p>I'm trying to test, within a stored procedure, whether a sequence already exists.</p>
  
  <pre><code>IF EXISTS SEQUENCE seq_name
      RAISE EXCEPTION 'sequence % already exists!', seq_name
  END IF;
  </code></pre>
  
  <p>I have tried several variations of the snippet above without luck. I must be giving Google the wrong terms because I can't seem to find anything on the topic. Any help is appreciated!</p>