This is a discussion on SQL COPY Command within the pgsql Novice forums, part of the PostgreSQL category; --> Will this command APPEND TO or REPLACE data in an existing table ? The documentation doesn't seem to indicate. ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Will this command APPEND TO or REPLACE data in an existing table ? The documentation doesn't seem to indicate. ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| |||
| "Van Ingen, Lane" <lvaningen@ESNCC.com> writes: > Will this command APPEND TO or REPLACE data in an existing table ? > The documentation doesn't seem to indicate. The first paragraph on the COPY reference page is COPY moves data between PostgreSQL tables and standard file-system files. COPY TO copies the contents of a table to a file, while COPY FROM copies data from a file to a table (appending the data to whatever is in the table already). regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) |
| |||
| On Wed, 27 Apr 2005 10:56:09 -0400, Tom Lane wrote > "Van Ingen, Lane" <lvaningen@ESNCC.com> writes: > > Will this command APPEND TO or REPLACE data in an existing table ? > > The documentation doesn't seem to indicate. > > The first paragraph on the COPY reference page is > > COPY moves data between PostgreSQL tables and standard file-system > files. COPY TO copies the contents of a table to a file, while COPY FROM > copies data from a file to a table (appending the data to whatever > is in the table already). > > regards, tom lane Sheesh, how did I miss that? Oh well, Documentation talks the talk but testing walks the walk. ;-) Kind Regards, Keith ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| ||||
| On Wed, 27 Apr 2005 10:43:58 -0400, Van Ingen, Lane wrote > Will this command APPEND TO or REPLACE data in an existing table ? > > The documentation doesn't seem to indicate. > You appear to be correct. I was not able to find the answer in the documentation either. Testing indicates that the data will be appended. If a primary key is defined on the table and any of the contents of the COPY violate that key then the entire contents of the COPY are rejected. During large copies this can result in a lot of wasted space. Kind Regards, Keith ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org |