title: postgresql erro: value too long for type character varying(256)
body: <p>I have looked into other solutions before but could not find out the problem from explanations. I am trying to run a python script where the data is loaded from an oltp MySQL database (AWS RDS) to an olap database on AWS Redshift. I have defined my table in Redshift as below:</p>
  <pre><code>create_product = (&quot;&quot;&quot;CREATE TABLE IF NOT EXISTS product (
      productCode varchar(15) NOT NULL PRIMARY KEY,
      productName varchar(70) NOT NULL,
      productLine varchar(50) NOT NULL,
      productScale varchar(10) NOT NULL,
      productVendor varchar(50) NOT NULL,
      productDescription text NOT NULL,
      buyPrice decimal(10,2) NOT NULL,
      MSRP decimal(10,2) NOT NULL
      )&quot;&quot;&quot;)
  </code></pre>
  <p>I am using a python script to load the data from RDS to Redshift. My function body to load</p>
  <pre><code>
      for query in dimension_etl_query:
          oltp_cur.execute(query[0])
          items = oltp_cur.fetchall()
          try:
              olap_cur.executemany(query[1], items)
              olap_cnx.commit()
              logger.info(&quot;Inserted data with: %s&quot;, query[1])
          except sqlconnector.Error as err:
              logger.error('Error %s Couldnt run query %s', err, query[1])
  </code></pre>
  <p>The script run throws the error</p>
  <p><strong>olap_cur.executemany(query[1], items)
  psycopg2.errors.StringDataRightTruncation: value too long for type character varying(256)</strong>
  I have checked in my SQL database for each of the columns length and only productDescription has length greater than 265 characters. However I am using text datatype in postgres for that column. Would appreciate any tips on how to find the rootcause?</p>