How to insert a string with '/' using COPY command from a text file

From: "shreedhar" <shreedhar(at)lucidindia(dot)net>
To: "Postgre General" <pgsql-general(at)postgresql(dot)org>
Subject: How to insert a string with '/' using COPY command from a text file
Date: 2003-04-10 10:32:19
Message-ID: 008f01c2ff4c$76c38e40$1201a8c0@a4005
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-04-10 11:29:15 Re: How to insert a string with '/' using COPY command from a text file
Previous Message Lincoln Yeoh 2003-04-10 10:10:04 Re: pg_dump / pg_dumpall / memory issues