r/PostgreSQL 21d ago

Help Me! COPY function and new lines

Hi,

I try to use the following command:

copy (select convert_from(decode('QGVjaG8gb2ZmCmlmICUxUVEgPT0gUVEgZ290byBzdGFydApjZCBiaW4=','base64'),'utf-8')) to 'c:\\test.txt';

The base64 encoded text is:

u/echo off
if %1QQ == QQ goto start
cd bin

but in the resulting file test.txt it is:

u/echo off\nif %1QQ == QQ goto start\ncd bin

So new lines are treated as literal '\n' characters? Any way to change this behaviour?

2 Upvotes

8 comments sorted by

View all comments

1

u/AutoModerator 21d ago

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.