Unix Technical Forum

Re: [PATCHES] problem with CR+LF in files in psql \i command

This is a discussion on Re: [PATCHES] problem with CR+LF in files in psql \i command within the pgsql Hackers forums, part of the PostgreSQL category; --> Euler Taveira de Oliveira wrote: > Hi Bruce, > > > Function and comments are just _strings_ to PostgreSQL, ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 04:14 AM
Bruce Momjian
 
Posts: n/a
Default Re: [PATCHES] problem with CR+LF in files in psql \i command

Euler Taveira de Oliveira wrote:
> Hi Bruce,
>
> > Function and comments are just _strings_ to PostgreSQL, so we have no
> > good way of cleaning the output up, unless we hack pg_dump to somehow
> > change line endings when outputting such information, though
> > currently we
> > don't. The would perhaps cause problems in viewing the functions if
> > restored in Win32.
> >

> Agreed.
>
> > Fixing it at the \i level is too crude because it might remove
> > carriage
> > returns that are wanted in the input stream.
> >

> Agreed.
>
> > We are open to ideas on how to improve this.
> >

> What about another option to pg_dump to indicate such a thing? Maybe -l
> or --change-line [m|w|u]


Yea, we could do that, but pg_dump seems like the wrong place to handle
this. For example, imagine if you have a mix of Win32 and Unix clients
--- if you create a function under Win32, it will look double-spaced to
a Unix client.

Ideally we would auto-convert the function text to the native client
format, but the function text is displayed via a SELECT, so how would we
special-case the function body SELECT output to output using the native
client line endings?

I am thinking we need a functions like unix_eol(), dos_eol(), or even
client_eol() to allow conversion of the output to an end-of-line format
matching the client. One nifty trick would be to modify the data type
of pg_proc.prosrc to auto-convert end-of-line format to match the
client. The problem there is that it special-cases a column just to fix
this single issue. Perhaps the ability to use functions like this is
the proper approach because they can be used in other places as well.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

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

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:26 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com