title: Insert after TRUE in condition in PostgreSQL
body: <p>I need to insert my values if only they are not presented in my table.
  I wrote the function:</p>
  <pre><code>    do
      $$
          declare
              v_video_config_bundle_id bigint;
              v_are_records_exist boolean;
          begin
              select id from config_bundle into v_video_config_bundle_id where code = 'video';
          
              select count(id) &gt; 0 from config_bundle into v_are_records_exist
              where config_bundle_id = v_video_config_bundle_id
              and preference = 'true' and amount = 0 and repeatability in (1,7,14,21,30,45) and format='day';
      
              case
              when (v_are_records_exist = false) then
                  insert into config_plan(config_bundle_id, amount, repeatability, format, payment_amount, preference_type, preference, trial, weight, status, is_default)
                  values (v_video_config_bundle_id, 0, 7, 'day', 0, 'personal', true, false, 2, 'ACTIVE', false),
                         (v_video_config_bundle_id, 0, 14, 'day', 0, 'personal', true, false, 2, 'ACTIVE', false),
                         (v_video_config_bundle_id, 0, 21, 'day', 0, 'personal', true, false, 2, 'ACTIVE', false);
              end;
          end;
      $$
  </code></pre>
  <p>But I still get an exception ERROR:</p>
  <pre><code>syntax error at or near &quot;;&quot;
    Position: 1420
  </code></pre>
  <p>How to fix it?</p>