Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9c48cae3
Commit
9c48cae3
authored
21 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Add pipe parameter to COPY function to allow proper line termination.
parent
3df163ad
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/src/sgml/ref/copy.sgml
+10
-10
10 additions, 10 deletions
doc/src/sgml/ref/copy.sgml
src/backend/commands/copy.c
+4
-4
4 additions, 4 deletions
src/backend/commands/copy.c
with
14 additions
and
14 deletions
doc/src/sgml/ref/copy.sgml
+
10
−
10
View file @
9c48cae3
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.4
2
2003/04/1
5
1
3:25:08 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v 1.4
3
2003/04/1
9
1
9:55:37 momjian
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -289,7 +289,7 @@ COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="
...
@@ -289,7 +289,7 @@ COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="
otherwise be taken as row or column delimiters. In particular, the
otherwise be taken as row or column delimiters. In particular, the
following characters <emphasis>must</> be preceded by a backslash if
following characters <emphasis>must</> be preceded by a backslash if
they appear as part of a column value: backslash itself,
they appear as part of a column value: backslash itself,
newline, and the current delimiter character.
newline,
carriage return,
and the current delimiter character.
</para>
</para>
<para>
<para>
...
@@ -355,16 +355,16 @@ COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="
...
@@ -355,16 +355,16 @@ COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="
It is strongly recommended that applications generating COPY data convert
It is strongly recommended that applications generating COPY data convert
data newlines and carriage returns to the <literal>\n</> and
data newlines and carriage returns to the <literal>\n</> and
<literal>\r</> sequences respectively. At present it is
<literal>\r</> sequences respectively. At present it is
possible to represent a data carriage return
without any special quoting,
possible to represent a data carriage return
by a backslash and carriage
and to represent a data newline by a backslash and newline.
However,
return,
and to represent a data newline by a backslash and newline.
these representations
will
not be accepted
by default
in future releases.
However,
these representations
might
not be accepted in future releases.
</para>
</para>
<para>
<para>
Note that the end of each row is marked by
a Unix-style
newline
<command>COPY TO</command> will terminate each row with
a Unix-style
(<quote><literal>\n</></>)
.
Presently, <command>COPY FROM</command> will not behave as
newline
(<quote><literal>\n</></>)
,
or carriage return/newline
desired if given a file containing DOS- or Mac-style new
lines
.
("\r\n") on MS Windows. <command>COPY FROM</command> can handle
lines
This is expected to change in future releas
es.
ending with newlines, carriage returns, or carriage return/newlin
es.
</para>
</para>
</refsect2>
</refsect2>
...
@@ -393,7 +393,7 @@ COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="
...
@@ -393,7 +393,7 @@ COPY <replaceable class="parameter">table</replaceable> [ ( <replaceable class="
12-byte sequence <literal>PGBCOPY\n\377\r\n\0</> --- note that the zero byte
12-byte sequence <literal>PGBCOPY\n\377\r\n\0</> --- note that the zero byte
is a required part of the signature. (The signature is designed to allow
is a required part of the signature. (The signature is designed to allow
easy identification of files that have been munged by a non-8-bit-clean
easy identification of files that have been munged by a non-8-bit-clean
transfer. This signature will be changed by
new
line-translation
transfer. This signature will be changed by
end-of-
line-translation
filters, dropped zero bytes, dropped high bits, or parity changes.)
filters, dropped zero bytes, dropped high bits, or parity changes.)
</para>
</para>
</listitem>
</listitem>
...
...
This diff is collapsed.
Click to expand it.
src/backend/commands/copy.c
+
4
−
4
View file @
9c48cae3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.19
2
2003/04/19
00:02:29 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.19
3
2003/04/19
19:55:37 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -114,7 +114,7 @@ static int server_encoding;
...
@@ -114,7 +114,7 @@ static int server_encoding;
*/
*/
static
void
SendCopyBegin
(
bool
binary
);
static
void
SendCopyBegin
(
bool
binary
);
static
void
ReceiveCopyBegin
(
bool
binary
);
static
void
ReceiveCopyBegin
(
bool
binary
);
static
void
SendCopyEnd
(
bool
binary
);
static
void
SendCopyEnd
(
bool
binary
,
bool
pipe
);
static
void
CopySendData
(
void
*
databuf
,
int
datasize
);
static
void
CopySendData
(
void
*
databuf
,
int
datasize
);
static
void
CopySendString
(
const
char
*
str
);
static
void
CopySendString
(
const
char
*
str
);
static
void
CopySendChar
(
char
c
);
static
void
CopySendChar
(
char
c
);
...
@@ -178,7 +178,7 @@ ReceiveCopyBegin(bool binary)
...
@@ -178,7 +178,7 @@ ReceiveCopyBegin(bool binary)
}
}
static
void
static
void
SendCopyEnd
(
bool
binary
)
SendCopyEnd
(
bool
binary
,
bool
pipe
)
{
{
if
(
!
binary
)
if
(
!
binary
)
CopySendData
(
"
\\
.
\n
"
,
3
);
CopySendData
(
"
\\
.
\n
"
,
3
);
...
@@ -680,7 +680,7 @@ DoCopy(const CopyStmt *stmt)
...
@@ -680,7 +680,7 @@ DoCopy(const CopyStmt *stmt)
if
(
!
pipe
)
if
(
!
pipe
)
FreeFile
(
copy_file
);
FreeFile
(
copy_file
);
else
if
(
IsUnderPostmaster
&&
!
is_from
)
else
if
(
IsUnderPostmaster
&&
!
is_from
)
SendCopyEnd
(
binary
);
SendCopyEnd
(
binary
,
pipe
);
pfree
(
attribute_buf
.
data
);
pfree
(
attribute_buf
.
data
);
/*
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment