Re: Appending values non-destructively

From: "Joshua b(dot) Jore" <josh(at)greentechnologist(dot)org>
To: Andre Dubuc <aajdubuc(at)webhart(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Appending values non-destructively
Date: 2002-05-08 21:15:08
Message-ID: Pine.BSO.4.44.0205081614060.32345-100000@kitten.greentechnologist.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Well actually... you'll probably do better to start with normal
single-value values before using arrays. Start simple (and there is
*tonnes* of stuff that you can do prior to arrays)

Joshua b. Jore
http://www.greentechnologist.org

On Wed, 8 May 2002, Andre Dubuc wrote:

> Thanks Joshua,
>
> I think I have more reading to do: I've sort of 'avoided' arrays and triggers, but reading what you're suggesting (and Stuart's ideas), I think I'll need to bone up on these areas.
>
> Great fun -- in the last month I've been learning PHP, so I guess it's Postgresql's turn now!
>
> Regards,
> Andre
>
>
> On Wednesday 08 May 2002 10:08 am, you wrote:
> > Well sure you can do that but there isn't anything special about a
> > delimiter. In general the value is atomic and there isn't anything smaller
> > than it. You could probably use a CASE expression to append new data to
> > the value or start the value. It almost sounds like you might want to
> > check out the array type and work with *that* instead since that at least
> > is an atomic collection of values. This isn't a case of being destructive,
> > you just have to include the previous value in the new value you write.
> > That's just standard stuff.
> >
> > Joshua b. Jore
> > http://www.greentechnologist.org
> >
> > On Wed, 8 May 2002, Andre Dubuc wrote:
> > > Using PostgreSQL 7.2 with PHP 4.1.2, I would like to use the UPDATE
> > > function to add values to a field in a row that already has a value or
> > > values, i.e.: in a field named 'sponsor', the current value is '2588'. I
> > > would like the new value in 'sponsor' to become '2588, 2961', and later ,
> > > '2588, 2961, 3166' etc.
> > >
> > > >From my newbie reading, I haven't discovered whether it is possible to
> > > > append
> > >
> > > values to a field without destroying the current value, and further,
> > > whether comma separators (or any sprators for that fact) are allowed or
> > > even possible.
> > >
> > > If some kind guru could help out with this simple question, I would
> > > greatly appreciate a small example code showing how to do it.
> > >
> > > Tia,
> > > Andre
> > >
> > >
> > > --
> > > Please pray the Holy Rosary to end the holocaust of abortion.
> > > Remember in your prayers the Holy Souls in Purgatory.
> > >
> > > May God bless you abundantly in His love!
> > > For a free Cenacle Scriptural Rosary Booklet:
> > > http://www.webhart.net/csrb/
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 2: you can get off all lists at once with the unregister command
> > > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
> --
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the Holy Souls in Purgatory.
>
> May God bless you abundantly in His love!
> For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Sharon Cowling 2002-05-08 21:47:00 Re: Incorrect Query
Previous Message Tom Lane 2002-05-08 20:44:52 Re: Too many clients