Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am trying import a database table to Postgres 9.3.5 database server using COPY command as follows:

    COPY comment (generatedid, id, "timestamp", message, bugreport_id, personcontainer_id) FROM stdin;
    1   12840538    2010-03-03 09:50:46 How is that an error in HttpClient? Don't buffer large content in memory, or configure memory in your VM appropriately. HTTPCLIENT-922  102
    2   12841503    2010-03-04 21:36:13 Thanks for having a look!<br/><br/>I explored and found problem is with org.apache.james.mime4j.util.CharsetUtil of mime4j jar. It tries to load all available charset classes present under JVM.<br/><br/>I know memory for Perm Gen can be increased but there would be limit. I have increased it and would be doing a round of load testing. If it still consumes whole allocated space I would be putting some fix on CharsetUtil.<br/><br/>Stack trace for reference:<br/>-----------------------------------------<br/>java.lang.OutOfMemoryError: PermGen space<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at sun.nio.cs.ext.IBM970$Encoder.&lt;clinit&gt;(IBM970.java:2688)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at sun.nio.cs.ext.IBM970.newEncoder(IBM970.java:45)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at java.lang.StringCoding$StringEncoder.&lt;init&gt;(StringCoding.java:215)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at java.lang.StringCoding$StringEncoder.&lt;init&gt;(StringCoding.java:207)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at java.lang.StringCoding.encode(StringCoding.java:266)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at java.lang.String.getBytes(String.java:947)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.james.mime4j.util.CharsetUtil.&lt;clinit&gt;(CharsetUtil.java:1028)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.http.entity.mime.MIME.&lt;clinit&gt;(MIME.java:51)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.http.entity.mime.HttpMultipart.&lt;clinit&gt;(HttpMultipart.java:85)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.http.entity.mime.MultipartEntity.&lt;init&gt;(MultipartEntity.java:78)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.http.entity.mime.MultipartEntity.&lt;init&gt;(MultipartEntity.java:101)<br/><br/>  HTTPCLIENT-922  103

But I have errors in all data being imported (I put up only 2 rows of data above to show all errors of generally way) like:

    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "}"
    LINE 1: }<br/>&nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "break"
    LINE 1: break;
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/><br/>Recompiling after this change and trying again the...
    ^
    ERROR: syntax error at or near "ll"
    LINE 1: ll provide a fix for CVS<br/>HEAD tomorrow. My apologies.<br...
    ^
    ERROR: syntax error at or near "Cookie"
    LINE 1: Cookie&#39;
    ^
    ERROR: syntax error at or near "headers"
    LINE 1: headers only.<br/><br/>Oleg HTTPCLIENT-292 28066
    ^
    ERROR: syntax error at or near "t"
    LINE 1: t had a chance to try this patch out, but if it works for yo...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s<br/>good enough for me.<br/><br/>Mike HTTPCLIENT-292 28068
    ^
    ERROR: syntax error at or near "d"
    LINE 1: d feel better if someone else had a look.<br/><br/>Oleg HTTP...
    ^
    ERROR: syntax error at or near "ll"
    LINE 1: ll try to come up with something more elegant for the 2.1 br...
    ^
    ERROR: syntax error at or near "t"
    LINE 1: t think either<br/>patch 2 or 3 handles this case, unless (i...
    ^
    ERROR: syntax error at or near "What"
    LINE 1: What we really need is a way to remove NTLM headers after th...
    ^
    ERROR: syntax error at or near "authentication"
    LINE 1: authentication has succeeded.<br/>Agreed. However, that stil...
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/>if (&quot;NTLM&quot;.equalsIgnoreCase(authscheme.getSch...
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "//"
    LINE 1: // clean up<br/>}<br/><br/>As far as HEAD CVS goes, there ar...
    ^
    ERROR: syntax error at or near "t"
    LINE 1: t not<br/>pretty, but that appears to be the only option we ...
    ^
    ERROR: syntax error at or near "ll"
    LINE 1: ll be working on a more elegant fix for the CVS HEAD<br/><br...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s the only real choice for 2.0.<br/><br/>Mike HTTPCLIENT-292...
    ^
    ERROR: syntax error at or near "m"
    LINE 1: m currently unable to test it and it could take a couple of ...
    ^
    ERROR: syntax error at or near "Digest"
    LINE 1: Digest schemes still need to be refactored to take<br/>advan...
    ^
    ERROR: syntax error at or near "code"
    LINE 1: code&gt;
    ^
    ERROR: syntax error at or near "public"
    LINE 1: public OutputStream getRequestOutputStream(boolean <br/>useC...
    ^
    ERROR: syntax error at or near "/"
    LINE 1: /code&gt;
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/><br/>The PutMethod does allow for chunking with the fun...
    ^
    ERROR: syntax error at or near "code"
    LINE 1: code&gt;
    ^
    unrecognized boolean value; assuming "on".
    Showing only tuples.
    \t: extra argument "Jun" ignored
    \t: extra argument "02" ignored
    \t: extra argument "00:39:55" ignored
    \t: extra argument "GMT+00:00" ignored
    \t: extra argument "20090)" ignored
    \t: extra argument "seems" ignored
    \t: extra argument "broken.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:150" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "SingleClientConnManager" ignored
    \t: extra argument "-" ignored
    \t: extra argument "Get" ignored
    \t: extra argument "connection" ignored
    \t: extra argument "for" ignored
    \t: extra argument "route" ignored
    \t: extra argument "HttpRoute[{}-&gt;<a" ignored
    \t: extra argument "href="http://www.seoconsultants.com">http://www.seoconsultants.com</a>]<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:334" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "ClientParamsStack" ignored
    \t: extra argument "-" ignored
    \t: extra argument "&#39;http.tcp.nodelay&#39;:" ignored
    \t: extra argument "true<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:335" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "ClientParamsStack" ignored
    \t: extra argument "-" ignored
    \t: extra argument "&#39;http.socket.buffer-size&#39;:" ignored
    \t: extra argument "8192<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:360" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "ClientParamsStack" ignored
    \t: extra argument "-" ignored
    \t: extra argument "&#39;http.protocol.version&#39;:" ignored
    \t: extra argument "HTTP/1.1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:361" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "ClientParamsStack" ignored
    \t: extra argument "-" ignored
    \t: extra argument "&#39;http.useragent&#39;:" ignored
    \t: extra argument "Mozilla/5.0" ignored
    \t: extra argument "(Macintosh;" ignored
    \t: extra argument "U;" ignored
    \t: extra argument "Intel" ignored
    \t: extra argument "Mac" ignored
    \t: extra argument "OS" ignored
    \t: extra argument "X" ignored
    \t: extra argument "10.5;" ignored
    \t: extra argument "en-US;" ignored
    \t: extra argument "rv:1.9.0.10)" ignored
    \t: extra argument "Gecko/2009042315" ignored
    \t: extra argument "Firefox/3.0.10<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:362" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "RequestAddCookies" ignored
    \t: extra argument "-" ignored
    \t: extra argument "CookieSpec" ignored
    \t: extra argument "selected:" ignored
    \t: extra argument "best-match<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:362" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "DefaultClientConnection" ignored
    \t: extra argument "-" ignored
    \t: extra argument "Connection" ignored
    \t: extra argument "shut" ignored
    \t: extra argument "down<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "2009/06/02" ignored
    \t: extra argument "13:14:12:363" ignored
    \t: extra argument "CEST" ignored
    \t: extra argument "[DEBUG]" ignored
    \t: extra argument "SingleClientConnManager" ignored
    \t: extra argument "-" ignored
    \t: extra argument "Releasing" ignored
    \t: extra argument "connection" ignored
    \t: extra argument "org.apache.http.impl.conn.SingleClientConnManager$<a" ignored
    \t: extra argument "href='mailto:ConnAdapter@3136e5'>ConnAdapter@3136e5</a><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[java]" ignored
    \t: extra argument "Exception" ignored
    \t: extra argument "in" ignored
    \t: extra argument "thread" ignored
    \t: extra argument "&quot;main&quot;" ignored
    \t: extra argument "java.lang.ClassCastException:" ignored
    \t: extra argument "org.apache.http.auth.AuthSchemeRegistry<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp [java]" ignored
    invalid command \tat
    ERROR: syntax error at or near "conn"
    LINE 1: conn.getRequestOutputStream((isHttp11() &amp;&amp; (null == ...
    ^
    ERROR: syntax error at or near "ve"
    LINE 1: ve made something wrong in compilation process because the c...
    ^
    ERROR: syntax error at or near "d"
    LINE 1: d attached successfully works in production nowadays. HTTPCL...
    ^
    invalid command \
    ERROR: syntax error at or near "ve"
    LINE 1: ve tried to use your code. I downloaded the source code of H...
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "Roland"
    LINE 1: Roland<br/> HTTPCLIENT-579 28761
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s not a problem for me to provide a totally functioning exam...
    ^
    ERROR: syntax error at or near "t"
    LINE 1: t attach example in this topic because it&#39;
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s closed.<br/><br/>Just send me your emails in a private mes...
    ^
    ERROR: syntax error at or near "ll"
    LINE 1: ll share the example.<br/> HTTPCLIENT-579 28762
    ^
    ERROR: syntax error at or near "ve"
    LINE 1: ve added a patch to the code you provided above to handle th...
    ^
    ERROR: syntax error at or near "Require"
    LINE 1: Require NTLMv2 session security&quot;
    ^
    ERROR: syntax error at or near "is"
    LINE 1: is set as an option inside &quot;
    ^
    ERROR: syntax error at or near "Network"
    LINE 1: Network security: Minimum session security for NTLM SSP base...
    ^
    ERROR: syntax error at or near "."
    LINE 1: .<br/><br/>The changes I made were a result of reading of: <...
    ^
    ERROR: syntax error at or near "d"
    LINE 1: d happily licence my change under the Apache Licence, I don&...
    ^
    ERROR: syntax error at or near "t"
    LINE 1: t believe it&#39;
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s allowed as the original patch was under the LGPL.<br/><br/...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s request that we can create an external project (on sourcef...
    ^
    ERROR: syntax error at or near "m"
    LINE 1: m running the same issue like Zhao had.  What was the resolu...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s unclear about resolution &#39;
    ^
    ERROR: syntax error at or near "Won"
    LINE 1: Won&#39;
    ^
    ERROR: syntax error at or near "t"
    LINE 1: t Fix &#39;
    ^
    ERROR: syntax error at or near "?<"
    LINE 1: ?<br/><br/>However, HttpClient 4.0 is capable of supporting ...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s not illegal. It&#39;
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s just that you create a package that is probably no longer ...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s the reason why we cannot provide this out of the box. What...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s license terms you will need to check with a software licen...
    ^
    ERROR: syntax error at or near "ve"
    LINE 1: ve decided to attach complete example of integration Axis, H...
    ^
    ERROR: syntax error at or near "d"
    LINE 1: d recommend you before sending your requests to figure out h...
    ^
    ERROR: syntax error at or near "s"
    LINE 1: s the problem? HTTPCLIENT-579 28773
    ^
    ERROR: syntax error at or near "project"
    LINE 1: project name=&quot;
    ^
    ERROR: syntax error at or near "casau"
    LINE 1: casau&quot;
    ^
    ERROR: syntax error at or near "default"
    LINE 1: default=&quot;
    ^
    ERROR: syntax error at or near "main"
    LINE 1: main&quot;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &gt;
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/>&nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &lt;
    ^
    ERROR: syntax error at or near "target"
    LINE 1: target name=&quot;
    ^
    ERROR: syntax error at or near "main"
    LINE 1: main&quot;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &gt;
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/>&nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &lt;
    ^
    ERROR: syntax error at or near "javac"
    LINE 1: javac srcdir=&quot;
    ^
    ERROR: syntax error at or near "."
    LINE 1: .&quot;
    ^
    ERROR: syntax error at or near "destdir"
    LINE 1: destdir=&quot;
    ^
    ERROR: syntax error at or near "."
    LINE 1: .&quot;
    ^
    ERROR: syntax error at or near "deprecation"
    LINE 1: deprecation=&quot;
    ^
    ERROR: syntax error at or near "yes"
    LINE 1: yes&quot;
    ^
    ERROR: syntax error at or near "debug"
    LINE 1: debug=&quot;
    ^
    ERROR: syntax error at or near "yes"
    LINE 1: yes&quot;
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/>&nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "classpath"
    LINE 1: classpath=&quot;
    ^
    ERROR: syntax error at or near ".."
    LINE 1: ../lib/commons-logging-1.0.4.jar;
    ^
    ERROR: syntax error at or near ".."
    LINE 1: ../lib/commons-codec-1.3.jar;
    ^
    ERROR: syntax error at or near ".."
    LINE 1: ../lib/commons-httpclient-3.0-ntlm-2.0.jar&quot;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &gt;
    ^
    ERROR: syntax error at or near "<"
    LINE 1: <br/>&nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &nbsp;
    ^
    ERROR: syntax error at or near "&"
    LINE 1: &lt;
    ^
    ERROR: syntax error at or near "include"
    LINE 1: include name=&quot;
    ^
    ERROR: syntax error at or near "**"
    LINE 1: **/*.java&quot;/&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/javac&...
  ^

How can I avoid these errors? Can I solve all errors using only one kind of change at the COPY command or in the data being imported?

share|improve this question
    
Have you tried to specify the delimiter? –  dezso Mar 12 at 16:46
    
I am importing using plain text format that don't need delimiter. To use delimiter is necessary the csv format and my data are in plain text format. I thought this way. –  Tarcisio M. Mar 12 at 16:52
    
In this case, plain text format, the delimiter is a tabspace. I have been tried the command with delimiter specification: COPY comment (generatedid, id, "timestamp", message, bugreport_id, personcontainer_id) FROM stdin WITH DELIMITER AS ' '; but did not work @dezso. –  Tarcisio M. Mar 12 at 17:01
    
Well, some of the errors that you show definitely don't come from the two lines of your input. It's very hard to tell what's exactly wrong. Try to export the data in a proper, quoted CSV format and COPY that. –  dezso Mar 13 at 7:38

1 Answer 1

up vote 0 down vote accepted

I don't know like but I solved with one strange command for situation: GRANT ALL ON SCHEMA schema_name TO psql_roler_name. After I typed the restore command and worked fine. Can somebody explain me this?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.