Skip to main content
Solved

Failure to write to postGIS database


fmenco
Contributor
Forum|alt.badge.img+5

Hi,

I'm trying to write data into a PostGIS database. However, I get the following error:

Bulk copy failed on table 'schemaname.dataset' * using delimiter ':'. Error was 'ERROR: value too long for type character varying(3)

CONTEXT: COPY dataset, line linenumber, column columnname : "attributevalue"

A fatal error has occurred. Check the logfile above for details

Bulk copy failed on table 'schemaname.dataset' using delimiter ':'. Error was 'no COPY in progress

The type character of the column is not set to have a width of only 3. But I keep getting this (or other similar errors).

I have tried multiple things:

- Using CSV instead of Excel as a datasource

- Increasing the width of the attributes

- Changing the type of the attributes ( text or string instead of varchar) of both the reader (input) and output (writer)

With the Excel file I would get a similar error, but on a different column and line. with the CSV it gets stuck.

I have to note that only a schema was implemented within the database, and nothing else.

*NB: I have anonymized the error for this post.

Best answer by nielsgerrits

Did you check the width of the column in pgAdmin?

What is your table handling parameter set at? I suspect it is at "Create If Needed". With this setting, once the table is created, it won't be changed the next time you write the data.

Changing the attribute width in FME won't change anything anymore, unless you change the parameter to "Drop and Create".

View original
Did this help you find an answer to your question?

5 replies

nielsgerrits
VIP
Forum|alt.badge.img+53
  • Best Answer
  • August 1, 2018

Did you check the width of the column in pgAdmin?

What is your table handling parameter set at? I suspect it is at "Create If Needed". With this setting, once the table is created, it won't be changed the next time you write the data.

Changing the attribute width in FME won't change anything anymore, unless you change the parameter to "Drop and Create".


fmenco
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • August 1, 2018
nielsgerrits wrote:

Did you check the width of the column in pgAdmin?

What is your table handling parameter set at? I suspect it is at "Create If Needed". With this setting, once the table is created, it won't be changed the next time you write the data.

Changing the attribute width in FME won't change anything anymore, unless you change the parameter to "Drop and Create".

Ye,s I have checked the width, and have changed it, too. But I keep getting the same error.

 

Yes, the table handling parameter is set at "create if needed". Do I need to change it to drop and create??

 


nielsgerrits
VIP
Forum|alt.badge.img+53
fmenco wrote:
Ye,s I have checked the width, and have changed it, too. But I keep getting the same error.

 

Yes, the table handling parameter is set at "create if needed". Do I need to change it to drop and create??

 

"Drop and Create" will literally drop (read remove) the table. As long as you are in a developing environment and the data in the table is no production I would use "Drop and Create".

jkr_wrk
Influencer
Forum|alt.badge.img+28
  • August 1, 2018
fmenco wrote:
Ye,s I have checked the width, and have changed it, too. But I keep getting the same error.

 

Yes, the table handling parameter is set at "create if needed". Do I need to change it to drop and create??

 

I think you should post the similar errors as well. This error (value too long for type character varying(3)) suggests there is a column with a width of character varying(3) and you say there isn't.

 

 

So maybe you solved this error by changing the width and now there are similar errors that must be fixed as well or you are writing to the wrong connection, schema or table?

 

 

Or something strange is happening and the database is giving an error that isn't there?

 


fmenco
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • August 1, 2018
jkr_da wrote:
I think you should post the similar errors as well. This error (value too long for type character varying(3)) suggests there is a column with a width of character varying(3) and you say there isn't.

 

 

So maybe you solved this error by changing the width and now there are similar errors that must be fixed as well or you are writing to the wrong connection, schema or table?

 

 

Or something strange is happening and the database is giving an error that isn't there?

 

Hi, that wat indeed the case, but I had set the table handling to "create if needed" and not to "drop and create". That's why the problem kept persisting even after I had changed the width of the conflicting clumn. Thanks for your input.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings