Re: [SPAM] COPY command & binary format

From: Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it>
To: Nicolas Paris <niparisco(at)gmail(dot)com>
Cc: Forums postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: [SPAM] COPY command & binary format
Date: 2016-05-10 12:47:04
Message-ID: 5731D848.1040804@evolu-s.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Il 10/05/2016 13:38, Nicolas Paris ha
scritto:<br>
</div>
<blockquote
cite="mid:CA+ssMOSVC-Yu+yQXeLHL3c0+iz4g1PEtRM49cVvQxyNFN3d4sA(at)mail(dot)gmail(dot)com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">2016-05-10 13:04 GMT+02:00 Moreno
Andreo <span dir="ltr">&lt;<a moz-do-not-send="true"
href="mailto:moreno(dot)andreo(at)evolu-s(dot)it" target="_blank">moreno(dot)andreo(at)evolu-s(dot)it</a>&gt;</span>:<br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><span class="">
<div>Il 10/05/2016 12:56, Nicolas Paris ha scritto:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">Hello,<br>
<br>
</div>
<div
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">What

is the way to build a binary format (instead of
a csv) ? Is there specification for this file ?<br>
<a moz-do-not-send="true"
href="http://www.postgresql.org/docs/9.5/static/sql-copy.html"
target="_blank">http://www.postgresql.org/docs/9.5/static/sql-copy.html</a><br>
</div>
</div>
</blockquote>
</span> I always create binary files with<br>
COPY table TO 'path/to/file' WITH BINARY<br>
<span class="HOEnZb"><font color="#888888"><br>
</font></span></div>
</blockquote>
<div> </div>
</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">​
Fine, this works in this way : <br>
postgresql -&gt; binary<br>
</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">binary
-&gt; postgresql<br>
<br>
</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">The
way I want is :<br>
</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">csv
-&gt; binary -&gt; postgresql<br>
</div>
</div>
</div>
</blockquote>
Is this just to be quicker or are you going to add some business
logic while converting CSV data?<br>
As you mentioned ETL, I assume the second, as I don't think that
converting CSV to binary and then loading it to PostgreSQL will be
more convenient than loading directly from CSV... as quicker as it
can be, you have anyway to load data from CSV.<br>
<br>
Binary file format is briefly described in the last part of the doc
you linked, under "Binary format", and there's also reference to
source files.<br>
<blockquote
cite="mid:CA+ssMOSVC-Yu+yQXeLHL3c0+iz4g1PEtRM49cVvQxyNFN3d4sA(at)mail(dot)gmail(dot)com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)"><br>
</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:rgb(0,51,51)">And
if possible, transforming csv to binary throught java​.<br>
</div>
</div>
</div>
</blockquote>
This is beyond my knowledge, ATM. I'm just starting with Java and
JDBC is still in the TODO list, sorry... :-)<br>
<br>
Cheers<br>
Moreno.-<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 4.1 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nicolas Paris 2016-05-10 13:00:55 Re: [SPAM] COPY command & binary format
Previous Message Pujol Mathieu 2016-05-10 12:39:50 Re: COPY command & binary format