title: 'stuff' and 'for xml path('')' from SQL Server in Postgresql
body: <p>I'm migrating some SQL Server 2008R2 queries to Postgresql 9.0 and I have some trouble with it.
  Here's the SQL Server query:</p>
  
  <pre><code>stuff((select ', '+p.[NAME] as 'data()' 
  from BPROVIDERS_PROVIDER p, BORDER_ARTICLEORDERPROVIDER aop 
  where p.OID = aop.PROVIDER for xml path('')),1,1,'')) as pNAMES
  </code></pre>
  
  <p>Reading SQL Server documentation I understand that this creates a comma separated list. I think that I can change <code>stuff</code> function to <code>overlay</code> function in Postresql'. Am I correct?</p>
  
  <p>The second problem comes with SQL Server's <code>for xml path</code> with ('') as a parameter. It returns the values assigned to an attribute called <code>pNAMES</code> instead of create row elements. Is that correct? </p>
  
  <p>Does Postgresql <code>Query_to_xml()</code> function  with attribute <code>tableforest = 'true'</code> do the same?</p>
  
  <p>Thank you. </p>