Re: Concatenating several rows with a semicolon

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Concatenating several rows with a semicolon
Date: 2010-12-29 06:58:53
Message-ID: AANLkTim=dyp6hNozaWCxba7BeR01C3he7ZZw4iDA1Nja@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/12/29 Alexander Farber <alexander(dot)farber(at)gmail(dot)com>

> Hello Dmitriy,
>
> I think this combination of attributes and children:
>
> >> >> > <user id="bla bla bla ...>
> >> >> > <pref_money date="2010-52" money="760" />
> >> >> > <pref_money date="2010-51" money="3848" />
> >> >> > ... etc ...
> >> >> > </user>
>
> will be a good balance between size and my original problem
> (combining user data and their stats in 1 chunk of information).
>
> And I don't use JSON, because it is not natively
> supported by Flex/Flash and my app is in Flex (here is its pic:
>
> http://stackoverflow.com/questions/4548878/pl-pgsql-concatenating-row-values-to-a-json-like-string
> )
>
> >> > Well, generally storing data in attributes should be avoided:
>
> You haven't backuped your statement by any arguments
>
:-) You have asked how to aggregate string -- I've answered you how
to do it by one statement without needs to write any of PL/pgSQL code.
So the string aggregation problem is solved. ;-)

This list is not correct place to discuss XML. My only argument is a
common sense. You don't make difference between the data and attributes.
The data of <pref_money> is obviously money amount and the date is
obviously its attribute:
<user id="id">
<pref_money date="2010-..">money_value</pref_money>
...
</user>

PS. If you don't want to follow this way you can "reduce" the size of XML
transfer by placing all the data in one tag:
<user id="id" prefmoneydate="2010-.." prefmoneyvalue="..."/>
...

:-)

> Regards
> Alex
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
// Dmitriy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2010-12-29 07:04:06 Re: B-tree index with sorting question
Previous Message Alan Hodgson 2010-12-29 06:54:30 Re: Restore problem