Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMbGg-0001Ay-CE for pgsql-general@arkaria.postgresql.org; Fri, 03 May 2019 16:42:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hMbGe-0006dc-SX for pgsql-general@arkaria.postgresql.org; Fri, 03 May 2019 16:42:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMbGe-0006dV-E4 for pgsql-general@lists.postgresql.org; Fri, 03 May 2019 16:42:36 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMbGc-0006on-3W for pgsql-general@lists.postgresql.org; Fri, 03 May 2019 16:42:35 +0000 Received: by mail-pg1-x544.google.com with SMTP id c13so2986942pgt.1 for ; Fri, 03 May 2019 09:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=/E77WPpYfJw4YNyNqgbb3pWt/e3HCx3y+n57xs1h6ro=; b=fcHu9a1gq5ns4cNBAdSTWK6UHCD7f6sfJs/a0itlY6yX+X20Oc1vEhOhCU+0DWy2xM +lPKwps/9VVNl+7jkqVp/MKt5ipNPMfhOZMFWYmMOBxoSfONOul0t1YF15WlHSnjE87+ 0I/ZA19hkC8xgjOE2nsUCIAP54Vt+tKakTKRIdibgQzLLwthl3XLBBe74KNgh1uvds7v aBQLL8TdR3HFsMHE4iIrw/jBFesqimF4nXkSR5iJ65MU2w2pLLeswaFkKpqa+lX8V+bz eTZGmNSGMlsLy8+3s4cVOdfD6l7uu6nyByxUIGYkpiuYC/vh1zPgbf9ysL/1SlxYtr0+ tYKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=/E77WPpYfJw4YNyNqgbb3pWt/e3HCx3y+n57xs1h6ro=; b=lwcmCiMkPD8vm1MebdbKhOw1fP2JLV02u0TN9cE49Bd5u9ZBUm/r6pyWX+X2vZIkSs HB1TJr5VKLf/DUvixsh2QqPR0wLOBA7j2yx3F90RuR8so17Hi8/VqXQ7DCZgnukIrKLM VkagYgxgrdfl9PwTjOq/IFvXOrpbPy4TN+0Y+IyqbAhrSZnoBhpu9hYQAW7aHf/pBhX2 hWX5Bf+nffLKaV2Il5kMfuhoLegh0duWqekHOFpDZjRN9XE20XGup1H8wQn144RsxOyu Tvjf/H/vQMvENHW7Ii8wrwYhOAVD/8lyrYirL6Rk/GMQ2wL2JfI3mMVwnx65mtygL4Fz ZO4g== X-Gm-Message-State: APjAAAUcxnymIsX6BhrZF4rpG3hQdNbls7++lcruMkSVQQgm8pOY2k8k h/lYVB3P1U7F1RY85TiDzGf6M6lG X-Google-Smtp-Source: APXvYqyqbVGDiLXn0MCiUcT0kQLxPxFEIuxUFshOJdZ8r65Vd2de+HZsYtEEW9nShGerPG7G8CBbxQ== X-Received: by 2002:aa7:8096:: with SMTP id v22mr12213557pff.94.1556901752587; Fri, 03 May 2019 09:42:32 -0700 (PDT) Received: from [10.104.134.41] ([155.100.47.1]) by smtp.gmail.com with ESMTPSA id p66sm3555224pfb.4.2019.05.03.09.42.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 09:42:31 -0700 (PDT) Subject: Re: Back Slash \ issue To: pgsql-general@lists.postgresql.org References: <3f17d700-5cfb-637a-dc70-112b69e53b01@aklaver.com> <797cd76f5520436f87e68ebe980972d3@HYDEXCHMBX003.TechMahindra.com> <1989ca98-23e4-21c2-addd-1710ad78cbf7@aklaver.com> <336AC136-C15B-4B46-899F-9674CA15500A@mail.com> <346D2F54-D13D-4C45-9E42-1E51F36ED85F@mail.com> <3c30cf5a10594124afb151a29e335ca2@HYDEXCHMBX003.TechMahindra.com> From: Rob Sargent Message-ID: Date: Fri, 3 May 2019 10:42:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <3c30cf5a10594124afb151a29e335ca2@HYDEXCHMBX003.TechMahindra.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/3/19 10:05 AM, Guntry Vinod wrote: > Hi Team, > > Here we go. I will give the problem in more detail > > Step 1:We get the dump from DB2 and this dump is flat file which can be csv,txt > Step2:There is table in PostGre where we are suppose to upload the dump > Step3:We are using copy command to upload dump to the table using (COPY <> from 'C:\Data_Dump\ABC.txt' DELIMITER '|'; ) > Step 4:In the above step we are using delimiter because the data is separated (:) in the flat which we have received from the flat file > > Problem Statement:We are able to upload the data from the flat file which we got from the DB2 but few data the data consist of " \".For example if the CustomerName is Vinod\G in the flat file ,we expect the same data in PostGre table for CustomerName as Vinod\G but we see VinodG(slash is missed). > > Possible Solution: We can replace "\" with "\\" but if the file is in too large we cannot open it(we can replace if the file is medium or small) > > Expectation: We need a command or utility which can upload the data as it is (for example if Vinod\G then we should see in PostGre as Vinod\G but not VinodG) > > So everything works except the backslashes disappear, correct? As many have said all you need to do is double the backslashes, and apparently you done that on small files.  How have you done that? Perhaps with an editor?  For the large files you must use a tool (perl awk, even a trivial C program) to double the backslashes.