Re: How to implement word wrap

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: "Thom Brown" <thombrown(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to implement word wrap
Date: 2010-03-30 10:27:46
Message-ID: 371F6ECE-4543-4489-B903-9268C531139D@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 30 Mar 2010, at 11:32, Andrus wrote:

>> Just realised that's not what you're after, but my first point still stands.
>
> Thank you.
> I tried to wrap words at 15 characters using code below.

Really, write a stored procedure that accepts (text, line_length) and returns SETOF text. You could even add hyphenation for the appropriate language if you go that route. For the latter it's probably best to write it in C so you can link hyphenation libraries to your code.

Another approach that may be viable is to use windowing functions, but I'm not so sure it's possible to have a window that is being defined by the data it's running over (eg. a window defined by the length of an accumulated line of text).

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.

!DSPAM:737,4bb1d23410411798520618!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Szymon Guz 2010-03-30 10:42:41 Re: insert into test_b (select * from test_a) with different column order
Previous Message Ole Tange 2010-03-30 10:27:32 Re: insert into test_b (select * from test_a) with different column order