title: postgres - violates check constraint error
body: <p>This is my table creation script, I am checking order_type before assigning any value to order_until field.</p>
  
  <pre><code>   CREATE TABLE merchants
      (
        id serial NOT NULL,
        name character varying(100),
        merchant_image bytea,
        merchant_logo bytea,
        merchant_longitude double precision,
        merchant_latitude double precision,
        merchant_address character varying(100),
        merchant_phone character varying(50),
        order_type character varying(15),
        open_until time without time zone,
        order_until time without time zone,
        CONSTRAINT merchants_pkey PRIMARY KEY (id),
        CONSTRAINT unique_name UNIQUE (name),
        CONSTRAINT merchants_check CHECK (
      CASE
          WHEN order_type::text = 'NO_ORDERING'::text THEN order_until = '00:00:00'::time without time zone
          ELSE NULL::boolean
      END),
        CONSTRAINT merchants_order_type_check CHECK (order_type::text = ANY (ARRAY['TAKE_AWAY'::character varying, 'HOME_DELIVERY'::character varying, 'NO_ORDERING'::character varying]::text[]))
      )
  </code></pre>
  
  <p>when I try to insert values in the table I got error: <strong>new row for relation "merchants" violates check constraint "merchants_check"</strong>
  Here is my insert script: </p>
  
  <pre><code>INSERT INTO MERCHANTS(NAME,MERCHANT_ADDRESS,MERCHANT_PHONE,ORDER_TYPE,OPEN_UNTIL,ORDER_UNTIL)
  VALUES('Test','Test address1','1234567','NO_ORDERING','22:00:00'::time,'20:00:00'::time);
  </code></pre>
  
  <p>Anyone has any suggestion how to fix this problem?</p>