<?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>LiangXu Wang &#187; postgresql</title>
	<atom:link href="http://wlx.westgis.ac.cn/tag/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://wlx.westgis.ac.cn</link>
	<description>technology backup/share</description>
	<lastBuildDate>Sat, 14 Jan 2012 03:56:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>postgresql中从多表中进行update</title>
		<link>http://wlx.westgis.ac.cn/734/</link>
		<comments>http://wlx.westgis.ac.cn/734/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 08:24:05 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=734</guid>
		<description><![CDATA[有时候，需要根据其他表的数据对某表的数据进行更新，这是就可以用到多表更新的功能： update metadata m set source=s.uuid from source s right join datasource d on s.id=d.sourceid where m.uuid=d.uuid]]></description>
			<content:encoded><![CDATA[<p>有时候，需要根据其他表的数据对某表的数据进行更新，这是就可以用到多表更新的功能：</p>
<blockquote><p>
update metadata m set source=s.uuid from source s right join datasource d on s.id=d.sourceid where m.uuid=d.uuid
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/734/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postgresql serial 不自动增长的问题</title>
		<link>http://wlx.westgis.ac.cn/577/</link>
		<comments>http://wlx.westgis.ac.cn/577/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 08:45:22 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=577</guid>
		<description><![CDATA[在手工导入原始数据后，其中的id项为serial类，由原始数据赋值，会遇到不自动增长的问题。 解决方案参考：http://bbs2.chinaunix.net/thread-1353824-1-1.html serial key其实是由sequence实现的，当你手动给serial列赋值的时候，sequence是不会自增量变化的，当你插入customer 6的时候看看customer_id sequence是多少？ 最好不要给serial手工赋值 SELECT setval(&#8216;序列名称&#8217;, max(id)) FROM 表; select setval(&#8216;offlineapp_id_seq&#8217;,max(id)) from offlineapp;]]></description>
			<content:encoded><![CDATA[<p>在手工导入原始数据后，其中的id项为serial类，由原始数据赋值，会遇到不自动增长的问题。</p>
<p>解决方案参考：http://bbs2.chinaunix.net/thread-1353824-1-1.html</p>
<blockquote><p>serial key其实是由sequence实现的，当你手动给serial列赋值的时候，sequence是不会自增量变化的，当你插入customer 6的时候看看customer_id sequence是多少？</p>
<p>最好不要给serial手工赋值</p>
<p>SELECT setval(&#8216;序列名称&#8217;, max(id)) FROM 表;
</p></blockquote>
<p>select setval(&#8216;offlineapp_id_seq&#8217;,max(id)) from offlineapp;</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/577/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu intrepid下安装proftpd配置postgresql后端</title>
		<link>http://wlx.westgis.ac.cn/546/</link>
		<comments>http://wlx.westgis.ac.cn/546/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 02:32:03 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[intrepid]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[proftpd]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=546</guid>
		<description><![CDATA[因为在另外一台机器上已经配置过，本以为很简单，复制过来就可以，没想到还是出问题，检查了半天，发现是group table没有设置的原因。 安装： sudo aptitude install proftpd proftp-pgsql 配置： 在/etc/proftpd/proftpd.conf里把 ＃Include /etc/proftpd/sql.conf 这行的注释去掉，然后修改/etc/proftpd/sql.conf文件，修改为： SQLBackend postgres SQLEngine on SQLAuthenticate users SQLAuthTypes Crypt Plaintext SQLConnectInfo db@server_name_or_ip user password RequireValidShell off SQLUserInfo ftp.users userid passwd uid gid homedir shell SQLGroupInfo ftp.groups groupname gid &#8230; <a href="http://wlx.westgis.ac.cn/546/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>因为在另外一台机器上已经配置过，本以为很简单，复制过来就可以，没想到还是出问题，检查了半天，发现是group table没有设置的原因。<br />
安装：<br />
sudo aptitude install proftpd proftp-pgsql<br />
配置：<br />
在/etc/proftpd/proftpd.conf里把</p>
<blockquote><p>＃Include /etc/proftpd/sql.conf</p></blockquote>
<p>这行的注释去掉，然后修改/etc/proftpd/sql.conf文件，修改为：</p>
<blockquote><p><IfModule mod_sql.c><br />
SQLBackend	postgres<br />
SQLEngine on<br />
SQLAuthenticate users<br />
SQLAuthTypes Crypt Plaintext<br />
SQLConnectInfo db@server_name_or_ip user password</p>
<p>RequireValidShell    off</p>
<p>SQLUserInfo     ftp.users userid passwd uid gid homedir shell<br />
SQLGroupInfo ftp.groups groupname gid members<br />
SQLDefaultUID        108   # CHANGE FOR YOUR FTP USERS UID FOUND IN /etc/passwd<br />
SQLDefaultGID        1002  # CHANGE FOR YOUR FTP USERS GID, FOUND IN /etc/groups<br />
SQLDefaultHomedir    /home/ftp<br />
RequireValidShell    off</p>
<p>SQLNegativeCache     off<br />
# 调试时打开<br />
#SQLLogFile           /var/log/proftpd-sql</p>
<p>SQLNamedQuery updatecount UPDATE “count=count+1 WHERE userid=&#8217;%u&#8217;” ftp.users<br />
SQLLOG	PASS	updatecount</p>
<p>SQLNamedQuery count SELECT “count from ftp.users where userid=&#8217;%u&#8217;”<br />
SQLShowInfo PASS “230&#8243; “You&#8217;ve logged on %{count} times, %u”</p>
<p>SQLLog               STOR newfile<br />
SQLNamedQuery        newfile FREEFORM “INSERT INTO ftp.logs(userid,action,file,abs_path,bytes) VALUES (&#8216;%U&#8217;,'upload&#8217;,'%J&#8217;,'%f&#8217;, &#8216;%b&#8217;)” </p>
<p>SQLLog RETR insertfileinfo<br />
SQLNamedQuery insertfileinfo FREEFORM “INSERT INTO ftp.logs(userid,action,file,abs_path,bytes) VALUES (&#8216;%U&#8217;,'download&#8217;,'%J&#8217;,'%f&#8217;, &#8216;%b&#8217;)”
</p></blockquote>
<p>数据库可以参考：http://www.howtoforge.com/proftpd_postgresql_auth_logging</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/546/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PostgreSQL: Introduction and Concepts</title>
		<link>http://wlx.westgis.ac.cn/350/</link>
		<comments>http://wlx.westgis.ac.cn/350/#comments</comments>
		<pubDate>Fri, 06 Apr 2007 09:55:04 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/350/</guid>
		<description><![CDATA[参考amazon上的介绍。 书比较老，是2000年的，但作者是PostgreSQL的活跃的开发者。 第一章很有意思，是讲发展历史，非常清楚，而且介绍了该项目发展过程的一些困难以及如何解决的问题。 附录很多，几乎占了一半的内容。]]></description>
			<content:encoded><![CDATA[<p><img src="http://ec1.images-amazon.com/images/P/0201703319.01._SCLZZZZZZZ_AA240_.jpg" alt="postgresql" /><br />
参考<a href="http://www.amazon.com/PostgreSQL-Introduction-Concepts-Bruce-Momjian/dp/0201703319">amazon</a>上的介绍。<br />
书比较老，是2000年的，但作者是PostgreSQL的活跃的开发者。<br />
第一章很有意思，是讲发展历史，非常清楚，而且介绍了该项目发展过程的一些困难以及如何解决的问题。<br />
附录很多，几乎占了一半的内容。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/350/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>升级postgresql-8.1的问题</title>
		<link>http://wlx.westgis.ac.cn/179/</link>
		<comments>http://wlx.westgis.ac.cn/179/#comments</comments>
		<pubDate>Tue, 28 Mar 2006 04:13:37 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.mygis.org/179/</guid>
		<description><![CDATA[升级的时候提示： 正在设置 postgresql-common (48ubuntu2) &#8230; dpkg：处理 postgresql-common (&#8211;configure)时出错： 子进程·post-installation script·返回了错误号·1 不知道是什么问题，搜索到ubuntu的BUG： https://launchpad.net/distros/ubuntu/+source/postgresql-common/+bug/36921/+index 才知道是因为DAPPER修改了版本号导致了此问题。 临时的解决方法： sudo apt-get install postgresql-client-common sudo nano /usr/share/postgresql-common/supported-versions # and change 6.04 to 6.06 sudo apt-get install postgresql-common # install other postgres packages as needed. # or &#8230; <a href="http://wlx.westgis.ac.cn/179/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>升级的时候提示：</p>
<blockquote><p>正在设置 postgresql-common (48ubuntu2) &#8230;<br />
dpkg：处理 postgresql-common (&#8211;configure)时出错：<br />
 子进程·post-installation script·返回了错误号·1
</p></blockquote>
<p>不知道是什么问题，搜索到ubuntu的BUG：</p>
<p>https://launchpad.net/distros/ubuntu/+source/postgresql-common/+bug/36921/+index</p>
<p>才知道是因为DAPPER修改了版本号导致了此问题。<br />
临时的解决方法：</p>
<blockquote><p>  sudo apt-get install postgresql-client-common<br />
sudo nano  /usr/share/postgresql-common/supported-versions<br />
# and change 6.04 to 6.06<br />
sudo apt-get install postgresql-common<br />
# install other postgres packages as needed.<br />
# or just do<br />
sudo apt-get -f install</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/179/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postgis在windows下的应用</title>
		<link>http://wlx.westgis.ac.cn/68/</link>
		<comments>http://wlx.westgis.ac.cn/68/#comments</comments>
		<pubDate>Tue, 05 Apr 2005 09:59:52 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[PostGIS]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.mygis.org/68/</guid>
		<description><![CDATA[目前，windows下的版本，postgresql官方已经开始支持，目前是8.0.1版本。POSTGIS目前官方尚不支持windows版本，但有支援者在进行同步维护windows版本，目前是1.0-rc6版本，估计很快就是1.0版本了。 1、安装 安装很简单，首先要安装postgresql，注意其有两个帐号，一是系统帐号，二是数据库管理帐号。安装程序可以新建用户，要提到一点，目前的postgresql数据库不支持远程安装，就是说，不能通过远程桌面进行安装（这个限制，不爽）。windows版本还包括了pgadmin3，图形化的管理界面。 然后安装postgis，需要前面安装postgresql的管理员帐号，同时其还要安装一个postgis数据库。 默认情况下，可执行文件都安装到postgresql的bin目录，几个SQL文件安装在postgresql的share/contrib目录下。 2、使用 对于中文用户来讲，首先要考虑数据库的编码问题，可以使用unicode,utf8,euc_cn等编码，默认的是unicode编码。 第一次使用unicode编码时移植linux下的应用，遇到了很多非常奇怪的问题。改用euc_cn编码，问题就少多了。 建库： createdb -U postgres -E EUC_CN db （linux环境下本机默认都不需要认证密码，但在windows系统下，默认是需要验证密码的） alter database db set client_encode=”EUC_CN” （这个要进入到psql环境中才能运行的，不确定是否必须，在linux环境下不需要） 搭建postgis环境： creatlang -U postgres plpgsql db (这个在windows下默认好象是不需要处理的） 引入postgis支持： psql -U postgres -d db -f lwpostgis.sql psql -U postgres &#8230; <a href="http://wlx.westgis.ac.cn/68/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>目前，windows下的版本，postgresql官方已经开始支持，目前是8.0.1版本。POSTGIS目前官方尚不支持windows版本，但有支援者在进行同步维护windows版本，目前是1.0-rc6版本，估计很快就是1.0版本了。</p>
<ul>
1、安装</ul>
<p>安装很简单，首先要安装postgresql，注意其有两个帐号，一是系统帐号，二是数据库管理帐号。安装程序可以新建用户，要提到一点，目前的postgresql数据库不支持远程安装，就是说，不能通过远程桌面进行安装（这个限制，不爽）。windows版本还包括了pgadmin3，图形化的管理界面。<br />
然后安装postgis，需要前面安装postgresql的管理员帐号，同时其还要安装一个postgis数据库。<br />
默认情况下，可执行文件都安装到postgresql的bin目录，几个SQL文件安装在postgresql的share/contrib目录下。</p>
<ul>
2、使用</ul>
<p>对于中文用户来讲，首先要考虑数据库的编码问题，可以使用unicode,utf8,euc_cn等编码，默认的是unicode编码。<br />
第一次使用unicode编码时移植linux下的应用，遇到了很多非常奇怪的问题。改用euc_cn编码，问题就少多了。</p>
<p>建库：<br />
createdb -U postgres -E EUC_CN db<br />
（linux环境下本机默认都不需要认证密码，但在windows系统下，默认是需要验证密码的）<br />
alter database db set client_encode=”EUC_CN”<br />
（这个要进入到psql环境中才能运行的，不确定是否必须，在linux环境下不需要）<br />
搭建postgis环境：<br />
creatlang -U postgres   plpgsql db<br />
(这个在windows下默认好象是不需要处理的）<br />
引入postgis支持：<br />
psql -U postgres -d db -f lwpostgis.sql<br />
psql -U postgres -d db -f spatial_ref_sys.sql<br />
生成矢量数据的sql文件：<br />
shp2pgsql xx.shp xx_table > xx.sql<br />
导入到数据库：<br />
psql -U postgres -d db -f xx.sql</p>
<ul>
3、开始应用</ul>
<p>到此，您的基本的postgis数据库就已经搭建好了，剩下的工作就是看您怎么去最大的压榨postgis的功能了。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/68/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>postgis的安装</title>
		<link>http://wlx.westgis.ac.cn/8/</link>
		<comments>http://wlx.westgis.ac.cn/8/#comments</comments>
		<pubDate>Tue, 16 Nov 2004 04:14:47 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[geos]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[PostGIS]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://blog.mygis.org/index.php?p=8</guid>
		<description><![CDATA[postgis-0.9,postgresql-8.0.0beta4,geos 2.0.1 1. install geos 2.0.1 LDFLAGS=-lstdc++ ./configure make make install 2. modify ld.so.conf nano /etc/ld.so.conf # add /usr/local/lib /sbin/ldconfig 3. install postgresql ./configure make make install # and run with computer start 4. install postgis # modify Makefile.config # &#8230; <a href="http://wlx.westgis.ac.cn/8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>postgis-0.9,postgresql-8.0.0beta4,geos 2.0.1</p>
<p>1. install geos 2.0.1<br />
LDFLAGS=-lstdc++ ./configure<br />
make<br />
make install<br />
2. modify ld.so.conf<br />
nano /etc/ld.so.conf<br />
# add /usr/local/lib<br />
/sbin/ldconfig<br />
3. install postgresql<br />
./configure<br />
make<br />
make install<br />
# and run with computer start<br />
4. install postgis<br />
# modify Makefile.config<br />
# change proj and geos directory<br />
rm -f -r /where/postgresql_source/contrib/<br />
cp -R postgis /where/postgresql_source/contrib/<br />
cd /where/contrib/postgis<br />
make<br />
make install<br />
5. init postgis<br />
su postgres<br />
createdb heihe<br />
createlang plpgsql heihe<br />
psql -d heihe -f lwpostgis.sql<br />
psql -d heihe -f spatial_ref_sys.sql<br />
6. dump your data to heihe db<br />
shp2pgsql river river heihe >  river.sql<br />
psql -d heihe -f river.sql</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

