Re: Concatenating several rows with a semicolon - Mailing list pgsql-general

From Dmitriy Igrishin
Subject Re: Concatenating several rows with a semicolon
Date
Msg-id AANLkTim=dyp6hNozaWCxba7BeR01C3he7ZZw4iDA1Nja@mail.gmail.com
Whole thread Raw
In response to Re: Concatenating several rows with a semicolon  (Alexander Farber <alexander.farber@gmail.com>)
List pgsql-general


2010/12/29 Alexander Farber <alexander.farber@gmail.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
// Dmitriy.


pgsql-general by date:

Previous
From: Alan Hodgson
Date:
Subject: Re: Restore problem
Next
From: Guillaume Lelarge
Date:
Subject: Re: B-tree index with sorting question