title: postgresql(aws redshift) error 1204 String length exceeds DDL length
body: <p>I am trying to import csv into aws redshift( postgresql 8.x) .</p>
  
  <p>The data flow is:
  mysql ->  parquet files on s3 -> csv files  on s3 -> redshift.</p>
  
  <h2>Table structure</h2>
  
  <p>The mysql table sql:</p>
  
  <pre><code>create table orderitems
  (
    id                         char(36) collate utf8_bin not null
      primary key,
    store_id                   char(36) collate utf8_bin not null,
    ref_type                   int                       not null,
    ref_id                     char(36) collate utf8_bin not null,
    store_product_id           char(36) collate utf8_bin not null,
    product_id                 char(36) collate utf8_bin not null,
    product_name               varchar(50)               null,
    main_image                 varchar(200)              null,
    price                      int                       not null,
    count                      int                       not null,
    logistics_type             int                       not null,
    time_create                bigint                    not null,
    time_update                bigint                    not null,
    ...
  );
  </code></pre>
  
  <p>I used same sql to create table in redshift , but it got error while importing csv.</p>
  
  <h2>My code import csv to redshift (python)</h2>
  
  <pre><code># parquet is dumpy by sqoop
  p2 = 'xxx'
  df = pd.read_parquet(path)    
  
  with smart_open.smart_open(p2, 'w') as f:
      df.to_csv(f, index=False)  # python3 default encoding is utf-8
  
  conn = psycopg2.connect(CONN_STRING)
  
  sql="""COPY %s FROM '%s' credentials 'aws_iam_role=%s' region 'cn-north-1' 
  delimiter ',' FORMAT AS CSV IGNOREHEADER 1 ; commit ;""" %  (to_table, p2, AWS_IAM_ROLE)
  print(sql)
  cur = conn.cursor()
  cur.execute(sql)
  conn.close()
  </code></pre>
  
  <h2>Got error</h2>
  
  <p>By checking <code>STL_LOAD_ERRORS</code> found error on <code>product_name</code> column
  <a href="https://i.stack.imgur.com/xokxW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xokxW.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>row_field_value : .............................................215g/... </li>
  <li>err_code: 1204</li>
  <li>err_reason: String length exceeds DDL length                                                                    </li>
  </ul>
  
  <p>The real_value is <code>伊利畅轻蔓越莓奇亚籽风味发酵乳215g/瓶</code>( chinese) .</p>
  
  <p>So it looks like some encoding problem. Since mysql is utf-8 and the csv is utf-8 too , I don't know what is wrong . </p>