By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,693 Members | 1,972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,693 IT Pros & Developers. It's quick & easy.

Especial delimiters caracter

P: n/a
running the following script

select ('cabal\\' || user_name) into temporary user_access from
tbl_user_access where access_profile_id = 4;
copy user_access to '/temp/users.txt' delimiters '|';

The result of the output file is...
domain\\users
but the field in the temp table is...
domain\users

I need the same result like temp table. How could i do it??

RGDS
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Tue, 2003-09-23 at 15:47, Montervino, Mariano wrote:
running the following script

select ('cabal\\' || user_name) into temporary user_access from
tbl_user_access where access_profile_id = 4;
copy user_access to '/temp/users.txt' delimiters '|';

The result of the output file is...
domain\\users
but the field in the temp table is...
domain\users
That is because COPY produces output that is suitable for input, and on
input backslashes must be escaped. There is no way to change this
behaviour.
I need the same result like temp table. How could i do it??


Assuming a Unix system, process the file with sed:

sed -e 's|\\\\|\\|g' /temp/users.txt > $$; mv $$ /temp/users.txt

(Note that the backslashes have to be escaped for sed, too.)

--
Oliver Elphick Ol************@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And we know that all things work together for good to
them that love God, to them who are the called
according to his purpose."
Romans 8:28
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.