Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lORkg-0005Lf-Lh for pgsql-general@arkaria.postgresql.org; Mon, 22 Mar 2021 21:06:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lORke-0002S9-IC for pgsql-general@arkaria.postgresql.org; Mon, 22 Mar 2021 21:06:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lORke-0002S2-8i for pgsql-general@lists.postgresql.org; Mon, 22 Mar 2021 21:06:16 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lORkY-0003Xx-3E for pgsql-general@lists.postgresql.org; Mon, 22 Mar 2021 21:06:15 +0000 Received: by mail-pj1-x1032.google.com with SMTP id cl21-20020a17090af695b02900c61ac0f0e9so156082pjb.1 for ; Mon, 22 Mar 2021 14:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=wnMf9Qy/ldeEKop4b4U/1wuLhQ6NyRsciOKhccecmxA=; b=OtDe8SiW6xHAD/wOP5szWqmq/SR1l9G24m/NoxGFnCmW+aI/syvN+cJWrlgMkNuKhF Dg34FKVxHvjDOxNcUnUd4zMWq3QfBXeGqz8+l+D2mhhLA0uLZsp7b9imQQnxuH+3Hrxh ABvNKI8NibwgYGYip6xzuzEEvfc48IzfGY+kHMsmqjeWDs24yw3FJWzbpsCv8vEnK+/Q 7WuiroADDRDhVvqRm+iDpF7lYNDHYgfBSLfkd4W3FnumMkQe/3I41aGvseeQr+/y/9ZQ 8BFd7jppq/YYK1pyXGhI51NwpvTn4Loyh2HdtaSpr9c+lgRymHmFifJ/NLpeEEIWSOCw vcHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=wnMf9Qy/ldeEKop4b4U/1wuLhQ6NyRsciOKhccecmxA=; b=Z6zetOHFTu3fFdZNED31F28lJ5JaDfFdGbvqLucSyS9Y+UuxwFuh6ZHxE7pKCiGAF+ s40WICM77t91yIEHtPWwrOf+dC3rTZ/XCqeEaM1b0Qz0VeRAmVppYpXysIMXLRl+BT5g Q9ZsYhDHQj53wtCFGRJgb8NA9nLsQhcJL60k5/rOc6eGS8juox6fF+Oex/U0uhaiMd0L fNLl+Bgqvd79/p3ayN5ZD3y681FUn1frwqSWifNSmnypyRo7OO9D82NDrBX6y7heR6ST hDPKjAJC6rlHhNGBziGWpLn6PeTfSVxcVxQWLYsdF9pGRbG1st2mbYAxQR+Q25/Nreo3 zTKQ== X-Gm-Message-State: AOAM532xp5HPYfkSks2bK1Y0ECHV6PsGDktYNrg38599ETzTSRIcG8iZ tK8lr5iWzjaKzpYU6ilJNas/IXTBK70= X-Google-Smtp-Source: ABdhPJyClp+23g0fHNApGL9+ZPWKJ4g4FWH18OZ8XQ87EQDSo6LumGaGX4/F3IlfxLO0vO1ytbcWlw== X-Received: by 2002:a17:90b:681:: with SMTP id m1mr939218pjz.168.1616447167720; Mon, 22 Mar 2021 14:06:07 -0700 (PDT) Received: from tim-desktop (106-69-144-140.dyn.iinet.net.au. [106.69.144.140]) by smtp.gmail.com with ESMTPSA id f13sm13049213pfj.8.2021.03.22.14.06.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 14:06:07 -0700 (PDT) References: User-agent: mu4e 1.5.11; emacs 27.2 From: Tim Cross To: pgsql-general@lists.postgresql.org Subject: Re: CSV From Oracle with timestamp column getting errors Date: Tue, 23 Mar 2021 07:56:42 +1100 In-reply-to: Message-ID: <87lfaeq4p0.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Saha, Sushanta K" writes: > \COPY table1 FROM '/tmp/Oracle_2020_06.csv' DELIMITER ',' CSV HEADER; > ERROR: invalid input syntax for type timestamp: "01-JUN-20 06.04.20.634000 AM" > CONTEXT: COPY table1, line 2, column last_update_timestamp: "01-JUN-20 06.04.20.634000 AM" > The problem is psql doesn't understand/recognise the timestamp format being used in the CSV dump from Oracle. Modify the SQL used to extract the data from Oracle so that it formats the timestamp as a string which psql can parse into a timestamp type - for example ISO or any of the psql timestamp formats (see psql manual). -- Tim Cross