pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Johnston <polobo@yahoo.com>
To: 'c k' <shreeseva.learning@gmail.com>
To: 'pgsql-admin' <pgsql-admin@postgresql.org>
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] grouping of query data in xml
Date: Sat, 21 Jan 2012 10:43:56 -0500
Message-ID: <002b01ccd853$7cc0b130$76421390$@yahoo.com> (raw)
In-Reply-To: <CAN2Y=uNKurwSBxdEpKDTTORCnfxordBaxc2yaRVn5amtaW-r3w@mail.gmail.com>
References: <CAN2Y=uNKurwSBxdEpKDTTORCnfxordBaxc2yaRVn5amtaW-r3w@mail.gmail.com>

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of c k
Sent: Saturday, January 21, 2012 10:23 AM
To: pgsql-admin; pgsql-general@postgresql.org
Subject: [GENERAL] grouping of query data in xml

 

Hi friends,

I am working with some xml exporting functionality of our application. I am testing query_to_xml function supported in PostgreSQL 9.1. XML output should be 
 <accgroup>

  <accgroupid>1</accgroupid>
  <accgroupname>COMPANY ACCOUNT</accgroupname>

 <docs>

  <refaccdocid>638168</refaccdocid>
  <debit>10000.0000</debit>
  <credit>0.0000</credit>

 </docs>
 <docs>

 <refaccdocid>638168</refaccdocid>
  <debit>0.0000</debit>
  <credit>10000.0000</credit>

  </docs>

</accgroup>

but the output is as follows:
<row>
  <accgroup>acc group</accgroup>
  <accgroupid>1</accgroupid>
  <accgroupname>COMPANY ACCOUNT</accgroupname>
  <docs>docs</docs>
  <refaccdocid>638168</refaccdocid>
  <debit>10000.0000</debit>
  <credit>0.0000</credit>
</row>

<row>
  <accgroup>acc group</accgroup>
  <accgroupid>1</accgroupid>
  <accgroupname>COMPANY ACCOUNT</accgroupname>
  <docs>docs</docs>
  <refaccdocid>638168</refaccdocid>
  <debit>0.0000</debit>
  <credit>10000.0000</credit>
</row>

How can grouping on specific columns can be done in result xml through using query_to_xml?
I am expecting help from postgresql community as always.

Thanks

CPKulkarni

 

Maybe provide the query you are trying to execute…?

Also, you should not post to multiple lists.  This is NOT an administration issue so you should not have included pgsql-admin.

Given that tables/query-results are two-dimensional why is it that you expect <docs> to have child elements?  Are you claiming the output is wrong or simply that you would like a different output than what you are being given?

David J.

view thread (7+ messages)  latest in thread

Message-ID: <002b01ccd853$7cc0b130$76421390$@yahoo.com>
Permalink:  ../002b01ccd853$7cc0b130$76421390$@yahoo.com/
Also on:    postgresql.org/message-id/002b01ccd853$7cc0b130$76421390$@yahoo.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-admin@postgresql.org
  Cc: polobo@yahoo.com, shreeseva.learning@gmail.com, pgsql-general@postgresql.org
  Subject: Re: [GENERAL] grouping of query data in xml
  In-Reply-To: <002b01ccd853$7cc0b130$76421390$@yahoo.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