<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dedy's Personal Site - Web Developer  - PHP Developer - PHP Freelancer &#187; Postgresql</title>
	<atom:link href="http://www.geraiweb.com/wordpress/category/database/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geraiweb.com/wordpress</link>
	<description>Get to know me.</description>
	<lastBuildDate>Thu, 03 Jun 2010 05:06:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Export isi table ke file dari postgresql database</title>
		<link>http://www.geraiweb.com/wordpress/2008/09/23/export-isi-table-ke-file-dari-postgresql-database/</link>
		<comments>http://www.geraiweb.com/wordpress/2008/09/23/export-isi-table-ke-file-dari-postgresql-database/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 10:47:22 +0000</pubDate>
		<dc:creator>dedy</dc:creator>
				<category><![CDATA[Postgresql]]></category>
		<category><![CDATA[export]]></category>

		<guid isPermaLink="false">http://www.geraiweb.com/wordpress/?p=34</guid>
		<description><![CDATA[ 
Untuk export ke file, bisa menggunakan perintah COPY.
kalau dari manual nya, kita bisa copy ke dan dari file/table.
Kebetulan gw pake postgre 7.2 : 
COPY [ BINARY ] tablename [ WITH OIDS ]
    FROM { 'filename' &#124; STDIN }
    [ [USING] DELIMITERS 'delimiter' ]
    [ WITH NULL AS [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>Untuk export ke file, bisa menggunakan perintah COPY.</p>
<p>kalau dari manual nya, kita bisa copy ke dan dari file/table.</p>
<p>Kebetulan gw pake postgre 7.2 : </p>
<pre class="SYNOPSIS">COPY [ BINARY ] <tt class="REPLACEABLE"><em>tablename</em></tt> [ WITH OIDS ]
    FROM { '<tt class="REPLACEABLE"><em>filename</em></tt>' | STDIN }
    [ [USING] DELIMITERS '<tt class="REPLACEABLE"><em>delimiter</em></tt>' ]
    [ WITH NULL AS '<tt class="REPLACEABLE"><em>null string</em></tt>' ]

COPY [ BINARY ] <tt class="REPLACEABLE"><em>tablename</em></tt> [ WITH OIDS ]
    TO { '<tt class="REPLACEABLE"><em>filename</em></tt>' | STDOUT }
    [ [USING] DELIMITERS '<tt class="REPLACEABLE"><em>delimiter</em></tt>' ]
    [ WITH NULL AS '<tt class="REPLACEABLE"><em>null string</em></tt>' ]</pre>
<p>Step-step nya :<br />
A. Masuk ke psql command line nya dulu pake user dengan permission u/ menjalankan perintah COPY, biasa nya &#8216;pg&#8217; atau &#8216;postgres&#8217;<br />
B. Kita bikin dulu temporary table , kalau kita butuh hanya specific data yang kita mau export :<br />
      #create temporary table <em>[table-name]</em> as <em>[sql-query].</em><br />
C. Kemudian kita baru export<br />
      #COPY <em>[table-name]</em> to &#8216;<em>/path/to/write/filename.txt using</em> DELIMITERS<em> </em>&#8216;;&#8217;;<br />
  path tersebut harus writeable oleh user postgre yang tadi kita gunakan untuk konek ke database.<br />
D. Hasil nya sdh merupakan file csv dari isi table yg ingin kita export.<br />
E. Finish</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geraiweb.com/wordpress/2008/09/23/export-isi-table-ke-file-dari-postgresql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
