Tag Archives: postgresql

postgresql中从多表中进行update

有时候,需要根据其他表的数据对某表的数据进行更新,这是就可以用到多表更新的功能: update metadata m set source=s.uuid from source s right join datasource d on s.id=d.sourceid where m.uuid=d.uuid

Posted in Program | Tagged , , | Leave a comment

postgresql serial 不自动增长的问题

在手工导入原始数据后,其中的id项为serial类,由原始数据赋值,会遇到不自动增长的问题。 解决方案参考:http://bbs2.chinaunix.net/thread-1353824-1-1.html serial key其实是由sequence实现的,当你手动给serial列赋值的时候,sequence是不会自增量变化的,当你插入customer 6的时候看看customer_id sequence是多少? 最好不要给serial手工赋值 SELECT setval(‘序列名称’, max(id)) FROM 表; select setval(‘offlineapp_id_seq’,max(id)) from offlineapp;

Posted in Computer | Tagged , | Leave a comment

ubuntu intrepid下安装proftpd配置postgresql后端

因为在另外一台机器上已经配置过,本以为很简单,复制过来就可以,没想到还是出问题,检查了半天,发现是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 … Continue reading

Posted in Linux | Tagged , , , | 1 Comment

PostgreSQL: Introduction and Concepts

参考amazon上的介绍。 书比较老,是2000年的,但作者是PostgreSQL的活跃的开发者。 第一章很有意思,是讲发展历史,非常清楚,而且介绍了该项目发展过程的一些困难以及如何解决的问题。 附录很多,几乎占了一半的内容。

Posted in Linux | Tagged , | Leave a comment

升级postgresql-8.1的问题

升级的时候提示: 正在设置 postgresql-common (48ubuntu2) … dpkg:处理 postgresql-common (–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 … Continue reading

Posted in Linux | Tagged , , | Leave a comment

postgis在windows下的应用

目前,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 … Continue reading

Posted in PostGIS | Tagged , , | 1 Comment

postgis的安装

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 # … Continue reading

Posted in GIS | Tagged , , , | 1 Comment