pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tony Wasson <ajwasson@gmail.com>
To: John Kopanas <john.kopanas@protoseinc.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: funstions for parsing words
Date: Tue, 19 Jul 2005 12:00:21 -0700
Message-ID: <6d8daee30507191200ca398d1@mail.gmail.com> (raw)
In-Reply-To: <1DFC0740-7EF9-4104-BDDF-C1436453EF33@protoseinc.com>
References: <1DFC0740-7EF9-4104-BDDF-C1436453EF33@protoseinc.com>

On 7/19/05, John Kopanas <john.kopanas@protoseinc.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



view thread (2+ messages)

Message-ID: <6d8daee30507191200ca398d1@mail.gmail.com>
Permalink:  ../6d8daee30507191200ca398d1@mail.gmail.com/
Also on:    postgresql.org/message-id/6d8daee30507191200ca398d1@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ajwasson@gmail.com, john.kopanas@protoseinc.com
  Subject: Re: funstions for parsing words
  In-Reply-To: <6d8daee30507191200ca398d1@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox