This is a discussion on duplicate columns with COPY within the pgsql Hackers forums, part of the PostgreSQL category; --> Is there a reason why COPY TO STDOUT does not allow columns to be specified more than once? pei=# ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Is there a reason why COPY TO STDOUT does not allow columns to be specified more than once? pei=# copy test1 (a, a) to stdout; ERROR: 42701: column "a" specified more than once Or is this just an overly extensive check that is actually intended for COPY FROM STDIN? -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| Peter Eisentraut wrote: > Is there a reason why COPY TO STDOUT does not allow columns to be specified > more than once? > > pei=# copy test1 (a, a) to stdout; > ERROR: 42701: column "a" specified more than once > > Or is this just an overly extensive check that is actually intended for COPY > FROM STDIN? > > You should be able to get around it with: COPY (SELECT a , a FROM test1) TO stdout; cheers andew ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| |||
| Hi, > > > > pei=# copy test1 (a, a) to stdout; > > ERROR: 42701: column "a" specified more than once > > > > Or is this just an overly extensive check that is actually intended for > COPY > > FROM STDIN? > > > > > This seems to be a common check in both "COPY TO" and "COPY FROM" cases source/destination being STDIN or otherwise. While it definitely makes sense for the FROM case maybe we could relax this for the COPY TO case. Regards, Nikhils -- EnterpriseDB http://www.enterprisedb.com |
| |||
| Peter Eisentraut <peter_e@gmx.net> writes: > Is there a reason why COPY TO STDOUT does not allow columns to be specified > more than once? > pei=# copy test1 (a, a) to stdout; > ERROR: 42701: column "a" specified more than once > Or is this just an overly extensive check that is actually intended for COPY > FROM STDIN? I think it's reasonable even for COPY TO, since IMHO the odds that it's a typo, rather than intentional, are probably 100:1. As already noted, we do have a workaround if that is truly what you intend. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org |
| ||||
| Am Donnerstag, 20. Dezember 2007 schrieb Tom Lane: > I think it's reasonable even for COPY TO, since IMHO the odds that it's > a typo, rather than intentional, are probably 100:1. ISTM that with this line of argument we could disable thousands of valid uses of SQL commands. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate |
| Thread Tools | |
| Display Modes | |
|
|