| From: | Tony Wasson <ajwasson(at)gmail(dot)com> |
|---|---|
| To: | John Kopanas <john(dot)kopanas(at)protoseinc(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: funstions for parsing words |
| Date: | 2005-07-19 19:00:21 |
| Message-ID: | 6d8daee30507191200ca398d1@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On 7/19/05, John Kopanas <john(dot)kopanas(at)protoseinc(dot)com> wrote:
> I have a table called Phrases that holds the text of a phrase. I want
> write a query that will return all the words found in all the text of
> the Phrases. Like so:
>
>
> Phrases:
> ------------
> "Hello World"
> "Goodbye World"
> "I like candy
>
> Words (select statement result):
> ------------
> "Hello"
> "World"
> "Goodbye"
> "I"
> "Like"
> "Candy"
>
> Is anything like this possible?
>
> Thanks alot.
>
> Your Friend,
>
> John Kopanas
You can do this by using array_to_string and using a space as your
delimiter. If you need to trim the quotes use the trim function also.
You can also see the split_on_commas example below -- you'd want to
split on a space. I would also rewrite this to use array_to_string or
use pl/perl if you can.
http://archives.postgresql.org/pgsql-sql/2005-05/msg00204.php
Hope this helps.
Tony Wasson
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tony Wasson | 2005-07-19 20:09:26 | Re: echo/printf function in plpgsql |
| Previous Message | John Kopanas | 2005-07-19 17:11:31 | funstions for parsing words |