#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Problem importing using copy command Date FIelds


    I have created a column which is 'timestamp without time zone' and when I try to import using 'copy' command, I get invalid input syntax for type timestamp "May 14 00:01:29". The column in question looks like "5/14/2013 1:29" in the original. I have tried various set date commands, but things still won't import. If I manually insert the data works fine. I would like to do on the 'copy' rather than having to copy to and from tables. Any ideas?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,786
    Rep Power
    349
    Originally Posted by symgryph
    I have tried various set date commands
    There is no "set date" command in Postgres.

    Why don't you show us exactly what you did instead of obfuscating your question.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by shammat
    There is no "set date" command in Postgres.

    Why don't you show us exactly what you did instead of obfuscating your question.
    Table looks like this:

    mytime timestamp without timezone
    srcfw inet
    ....

    Trying to import the following csv:
    5/14/2013 3:54,10.234.25.5,10.234.25.,......

    Use the following copy command:
    copy dogs from '/var/lib/postgresql/falz/fisall.csv' using delimiters ',';

    Get the following error:

    input syntax for type typmetamp "May 14 00:01:29" context COPY: dogs line 1 column mytime: "May 14 00:01:29"
    Last edited by symgryph; May 21st, 2013 at 05:51 PM. Reason: oopsed

IMN logo majestic logo threadwatch logo seochat tools logo