How to insert a string with '/' using COPY command from a text file - Mailing list pgsql-general

From shreedhar
Subject How to insert a string with '/' using COPY command from a text file
Date
Msg-id 008f01c2ff4c$76c38e40$1201a8c0@a4005
Whole thread Raw
Responses Re: How to insert a string with '/' using COPY command from a text file  (Richard Huxton <dev@archonet.com>)
List pgsql-general
Hello All
 
 
 tblTemp (
catalogid INTEGER NOT NULL DEFAULT 0,
DirPath Varchar(250) NOT NULL DEFAULT '',
TypeName VARCHAR(100)  NOT NULL DEFAULT '', 
size FLOAT NOT  NULL DEFAULT 0, 
filedate datetime NOT NULL
) ;
 
Input text file
10|cdrom\games\themes\newyears1.zip|WinZip File (Folder)|729990|11/24/2001 01:41:32 AM
 
If I directly use Copy command
 
1) data is storing in table as following
 
catalogid     dirpath                                        typename                 size                    filedate
10    cdromgamesthemesnewyears1.zip         WinZip File            729990        2001-11-24 01:41:32
 
 
2) If change input as
 
10|cdrom/\games/\themes/\newyears1.zip|WinZip File (Folder)|729990|11/24/2001 01:41:32 AM
 
Output in table is
 
catalogid     dirpath                                typename                 size                    filedate
10    cdrom/games/    hemes                 WinZip File            729990               2001-11-24 01:41:32
        / ewyears1.zip                
 
I mean it is taking TAB and NEWLINE characters.
 
3) If change input as
 
10|cdrom/\games\\themes\\newyears1.zip|WinZip File (Folder)|729990|11/24/2001 01:41:32 AM
 
Output in table is
 
catalogid     dirpath                                typename                 size                    filedate
10    cdrom/games\themes\newyears1.zip               WinZip File            729990               2001-11-24 01:41:32
 
I mean '\' is appearing instead of '/'
 
My expected output is
catalogid     dirpath                                typename                 size                    filedate
10    cdrom/games/themes/newyears1.zip               WinZip File            729990               2001-11-24 01:41:32
 
How can I change my input file to get expected result.
 
REGARDS,
SREEDHAR                        

pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: pg_dump / pg_dumpall / memory issues
Next
From: Richard Huxton
Date:
Subject: Re: How to insert a string with '/' using COPY command from a text file