title: Load NULL TIMESTAMP with TIME ZONE using COPY FROM in PostgreSQL
body: <p>I have a CSV file that I'm trying to load into a PostgreSQL 9.2.4 database using the <code>COPY FROM</code> command. In particular there is a timestamp field that is allowed to be null, however when I load &quot;null values&quot; (actually just <code>&quot;&quot;</code>) I get the following error:</p>
  <pre><code>ERROR:  invalid input syntax for type timestamp with time zone: &quot;&quot;
  </code></pre>
  <p>An example CSV file looks as follows:</p>
  <pre><code>id,name,joined
  1,&quot;bob&quot;,&quot;2013-10-02 15:27:44-05&quot;
  2,&quot;jane&quot;,&quot;&quot;
  </code></pre>
  <p>The SQL looks as follows:</p>
  <pre><code>CREATE TABLE &quot;users&quot;
  (
      &quot;id&quot; BIGSERIAL NOT NULL PRIMARY KEY,
      &quot;name&quot; VARCHAR(255),
      &quot;joined&quot; TIMESTAMP WITH TIME ZONE,
  );
  
  COPY &quot;users&quot; (&quot;id&quot;, &quot;name&quot;, &quot;joined&quot;)
      FROM '/path/to/data.csv'
      WITH (
          ENCODING 'utf-8',
          HEADER 1,
          FORMAT 'csv'
      );
  </code></pre>
  <p>According to the <a href="http://www.postgresql.org/docs/9.2/static/sql-copy.html" rel="noreferrer">documentation</a>, null values should be represented by an empty string that cannot contain the quote character, which is double quote (<code>&quot;</code>) in this case:</p>
  <blockquote>
  <p>NULL</p>
  <p>Specifies the string that represents a null value. The default is \N (backslash-N) in text format, and an unquoted empty string in CSV format. You might prefer an empty string even in text format for cases where you don't want to distinguish nulls from empty strings. This option is not allowed when using binary format.</p>
  <p><strong>Note:</strong> When using COPY FROM, any data item that matches this string will be stored as a null value, so you should make sure that you use the same string as you used with COPY TO.</p>
  </blockquote>
  <p>I've tried the option <code>NULL ''</code> but that seems to have no affect. Advice, please!</p>