Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: nesting Xml...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3557 of 3799
Post > Topic >>

Re: nesting XmlAgg

by peter_e@[EMAIL PROTECTED] (Peter Eisentraut) Jul 3, 2008 at 03:15 PM

Am Donnerstag, 3. Juli 2008 schrieb Isaac Dover:
> select
>   XmlElement(name "Catalog",
>     XmlElement(name "Tables",
>       XmlAgg(XmlElement(name "Table", XmlAttributes(T.table_name as
> "Name"), XmlElement(name "Columns",
> -- i was attempting to aggregate here as well
>         (select XmlElement(name "Column", C.Column_Name))
>     )
>       ))
>     )
>   )
> from information_schema.tables T
> inner join information_schema.columns C
>     on T.table_name = C.table_name and T.table_schema = C.table_schema
> where T.table_schema = 'public'

Try this:

select
  XmlElement(name "Catalog",
    XmlElement(name "Tables",
      XmlAgg(XmlElement(name "Table", XmlAttributes(T.table_name as
"Name"),
    XmlElement(name "Columns",
        (select XmlAgg(XmlElement(name "Column", C.Column_Name)) from 
information_schema.columns C where T.table_name = C.table_name and 
T.table_schema = 
C.table_schema)                                                           
                                                                          
)
      ))
    )
  )
from information_schema.tables T
where T.table_schema = 'public';

-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 1 Posts in Topic:
Re: nesting XmlAgg
peter_e@[EMAIL PROTECTED]  2008-07-03 15:15:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:37:12 CST 2008.