I have the following dataset in my postgres database: 

```
 paperid | authorid |         name         |  
---------+----------+----------------------+
  896452 |     4976 | S. R. Duc            | 
  896452 |   186921 | F. Kolo              | 
  896452 |   318493 | C. D. Becker         | 
  896452 |   615968 | V. B. Duthon         | 
  896452 |   823663 | C. C. Charbonnier    | 
  896452 |   833091 | P. Hoffmeyer         | 
  896452 |   843054 | C. W. A. Pfirrmann   | 
  896452 |  1058596 | J. Menetrey          | 
  896452 |  2033639 | N. Magnenat-Thalmann | 

```

From that I would like to create an entry for each of the authors for given paper with additional column 'Coauthors' - listing all coauthors delimited by space, like (but for each of the authors):

```
 paperid |   author          |                                                         coauthors                                                             
---------+-------------------+------------------------------------------------------------------------------------------------------------
  896452 | S. R. Duc         | C. C. Charbonnier C. D. Becker C. W. A. Pfirrmann F. Kolo J. Menetrey N. Magnenat-Thalmann P. Hoffmeyer V. B. Duthon
  896452 | C. C. Charbonnier | S. R. Duc  C. D. Becker C. W. A. Pfirrmann F. Kolo J. Menetrey N. Magnenat-Thalmann P. Hoffmeyer V. B. Duthon
... etc for each coauthor

```

**EDIT** 

Ok, so for now I have a query which will create a cross product for each author from the column and the created coauthors column, but I still need to remove the single author from the coauthors column

```
SELECT foo.paperid, npa.name, foo.authors FROM newpaperauthor npa CROSS JOIN (select paperid, string_agg(name, ' ')  as authors                                
FROM newpaperauthor 
GROUP BY paperid 
ORDER BY paperid) foo ;
 paperid |         name         |                                                            authors                                                             
---------+----------------------+--------------------------------------------------------------------------------------------------------------------------------
  896452 | S. R. Duc            | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | F. Kolo              | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | C. D. Becker         | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | V. B. Duthon         | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | C. C. Charbonnier    | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | P. Hoffmeyer         | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | C. W. A. Pfirrmann   | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | J. Menetrey          | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann
  896452 | N. Magnenat-Thalmann | S. R. Duc F. Kolo C. D. Becker V. B. Duthon C. C. Charbonnier P. Hoffmeyer C. W. A. Pfirrmann J. Menetrey N. Magnenat-Thalmann

```