<?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>doradoradora &#187; PosrgreSQL</title>
	<atom:link href="http://dora-0o0-emon.net/tag/posrgresql/feed" rel="self" type="application/rss+xml" />
	<link>http://dora-0o0-emon.net</link>
	<description>blog</description>
	<lastBuildDate>Sat, 19 Sep 2009 05:50:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PostgreSQL・pgAdmin IIIで関数のデバッグ</title>
		<link>http://dora-0o0-emon.net/linux/entry-9.html</link>
		<comments>http://dora-0o0-emon.net/linux/entry-9.html#comments</comments>
		<pubDate>Tue, 01 Jul 2008 17:03:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[PosrgreSQL]]></category>

		<guid isPermaLink="false">http://dora-0o0-emon.net/?p=9</guid>
		<description><![CDATA[pgAdminIII で PostgreSQL の関数やトリガをデバッグできるようなの
で調べました。
以下はその備忘録です。
OSはCentOS4.6、PostgreSQLは8.3です。







pgfou [...]]]></description>
			<content:encoded><![CDATA[<p>pgAdminIII で PostgreSQL の関数やトリガをデバッグできるようなの<br />
で調べました。<br />
以下はその備忘録です。<br />
OSはCentOS4.6、PostgreSQLは8.3です。<br />
<span id="more-9"></span><br />
<br />
<script type="text/javascript"><!--
google_ad_client = "pub-8857586699971285";
/* 728x90, 作成済み 09/09/06 */
google_ad_slot = "5536792068";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<br />
<a href="http://pgfoundry.org/projects/edb-debugger">pgfoundry</a> から edb-debugger をダウンロードします。<br />
最新の0.92をダウンロードしました。<br />
<br />
PostgreSQLのインストール時に作ったディレクトリがそのまま残っていたので、それを使います。<br />
（/usr/local/src/postgresql-8.3.3 ）<br />
ダウンロードしてきた edb-debugger は /usr/local/src/ に置いています。</p>
<pre class="brush: plain;">
$ cd /usr/local/src/postgresql-8.3.3/contrib/
$ tar zxvf /usr/local/src/edb-debugger-0.92.tgz
$ cd ./pldebugger
$ make
$ make install
</pre>
<p>※edb-debugger0.91 は展開すると アーカイブのトップは /contrib となっていて 0.92 とは構造が違うようです。<br />
</p>
<pre class="brush: plain;">
$ make install
Makefile:63: 警告: ターゲット `install' へのコマンドを置き換えます
../../src/makefiles/pgxs.mk:115: 警告: ターゲット `install' への古いコマンドは無視されます
Makefile:77: 警告: ターゲット `installdirs' へのコマンドを置き換えます
../../src/makefiles/pgxs.mk:153: 警告: ターゲット `installdirs' への古いコマンドは無視されます
mkdir -p -- /usr/local/pgsql/lib/plugins
mkdir -p -- /usr/local/pgsql/share/contrib
 /bin/sh ../../config/install-sh -c -m 755  pldbgapi.so '/usr/local/pgsql/lib'
 /bin/sh ../../config/install-sh -c -m 755  targetinfo.so '/usr/local/pgsql/lib'
 /bin/sh ../../config/install-sh -c -m 755  plugin_debugger.so '/usr/local/pgsql/lib/plugins'
/bin/sh ../../config/install-sh -c -m 644 ./pldbgapi.sql '/usr/local/pgsql/share/contrib'
</pre>
<p>
postgresql.conf に shared_preload_libraries を追加します。</p>
<pre class="brush: plain;">
$ vi /usr/local/pgsql/data/postgresql.conf
shared_preload_libraries = '/usr/local/pgsql/lib/plugins/plugin_debugger.so'
</pre>
<p>
データベースに edb-debugger の SQLを流します。<br />
既にデータベースが存在する時は、そのデータベースでもSQLを実行する必要があるかも</p>
<pre class="brush: plain;">
$ su - postgres
$ psql -d template1 -f /usr/local/pgsql/share/contrib/pldbgapi.sql
CREATE TYPE
CREATE TYPE
CREATE TYPE
CREATE TYPE
CREATE TYPE
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
</pre>
<p>
PostgreSQLを再起動。<br />
<br />
pgAdminIII の メニュー -> ツール に デバッグが追加されています。<br />
<img src="/wordpress/wp-content/WS000002.JPG" alt="pgadmin" /></p>
]]></content:encoded>
			<wfw:commentRss>http://dora-0o0-emon.net/linux/entry-9.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
