1
1
.\" This is -*-nroff-*-
2
2
.\" XXX standard disclaimer belongs here....
3
- .\" $Header: /cvsroot/pgsql/doc/man/Attic/copy.l,v 1.2 1996/09/19 20:08:09 scrappy Exp $
3
+ .\" $Header: /cvsroot/pgsql/doc/man/Attic/copy.l,v 1.3 1996/09/19 20:09:01 scrappy Exp $
4
4
.TH COPY SQL 11/05/95 Postgres95 Postgres95
5
5
.SH NAME
6
6
copy \(em copy data to or from a class from or to a Unix file.
7
7
.SH SYNOPSIS
8
8
.nf
9
- \fB copy \fP [\fB binary \fP ] classname
9
+ \fB copy \fP [\fB binary \fP ] classname [ \fB with oids \fP ]
10
10
\fB to \fP |\fB from \fP "filename"|\fB stdin \fR |\fB stdout \fR
11
- [\fB USING DELIMITERS \fP delim]
11
+ [\fB using delimiters \fP delim]
12
12
.fi
13
13
.SH DESCRIPTION
14
14
.BR Copy
@@ -18,6 +18,11 @@ keyword
18
18
changes the behavior of field formatting, as described below.
19
19
.IR Classname
20
20
is the name of an existing class.
21
+ The keyword
22
+ .BR " with oids"
23
+ copies the internal unique object id (OID) for each row.
24
+ .IR Classname
25
+ is the name of an existing class.
21
26
.IR Filename
22
27
is the Unix pathname of the file. In place of a filename, the
23
28
keywords
@@ -26,24 +31,29 @@ can be used so that input to
26
31
.BR copy
27
32
can be written by a Libpq application and output from the
28
33
.BR copy
29
- command can be read by a Libpq application. The
34
+ command can be read by a Libpq application.
35
+ .PP
36
+ The
30
37
.BR binary
31
38
keyword will force all data to be stored/read as binary objects rather
32
39
than as ASCII text. It is somewhat faster than the normal
33
40
.BR copy
34
41
command, but is not generally portable, and the files generated are
35
42
somewhat larger, although this factor is highly dependent on the data
36
43
itself.
37
- .PP
38
- By default,
44
+ When copying in, the
45
+ .BR " with oids"
46
+ keyword should only be used on an empty database because
47
+ the loaded oids could conflict with existing oids.
48
+ By default, a ASCII
39
49
.BR copy
40
50
uses a tab (\\t ) character as a delimiter. The delimiter may also be changed
41
51
to any other single-character with the use of
42
- .BR " USING DELIMITERS " .
52
+ .BR " using delimiters " .
43
53
Characters in data fields which happen to match the delimiter character
44
54
will be quoted.
45
55
.PP
46
- You must have read access on any class whose values are read by the
56
+ You must have read access on any class whose values are read by the
47
57
.BR copy
48
58
command, and either write or append access to a class to which values
49
59
are being appended by the
@@ -69,6 +79,7 @@ The actual format for each instance is
69
79
.nf
70
80
<attr1><tab><attr2><tab>...<tab><attrn><newline>
71
81
.fi
82
+ The oid is placed on the beginning of the line if specified.
72
83
.PP
73
84
If
74
85
.BR copy
@@ -111,12 +122,16 @@ this format must be followed
111
122
Unsigned four-byte integer quantities are called uint32 in the below
112
123
description.
113
124
.nf
114
- uint32 totallength (not including itself),
115
- uint32 number of null attributes
116
- [uint32 attribute number of first null attribute
117
- ...
118
- uint32 attribute number of nth null attribute],
119
- <data>
125
+ The first value is:
126
+ uint32 number of tuples
127
+ then for each tuple:
128
+ uint32 total length of data segment
129
+ uint32 oid (if specified)
130
+ uint32 number of null attributes
131
+ [uint32 attribute number of first null attribute
132
+ ...
133
+ uint32 attribute number of nth null attribute],
134
+ <data segment>
120
135
.fi
121
136
.bp
122
137
.SS "ALIGNMENT OF BINARY DATA"
0 commit comments