摘要:PostgreSQL: function 返回结果集多列和单列的例子2012-06-23 13:10:21|分类: Postgres基础 |标签: |字号大中小订阅 今天有人问到在 PostgreSQL 函数中如何返回结果集的单列,返回结果集(多列)的方法很多,那么如何返回结果集的单列呢,做了下测试,具体步骤如下:一 测试一:返回多条记录(单列)--1 创建测试表并插入记录skytf=> create table test_result1 (id integer,name varchar(32));CREATE TABLEskytf=> create table test_resu
阅读全文
摘要:PostgreSQL SQL Injection Attack MitigationOPENSSL 转载 - 1PostgreSQL quote ident and literal2013-05-21 16:08:58|分类: PgSQL Develop |标签: |字号大中小订阅前面一篇介绍了SQL注入, 其中利用字符逃逸漏洞的占了主要部分.PostgreSQL 提供了几个函数用来输出转义后的字符串.quote_ident(stringtext)textReturn the given string suitably quoted to be used as an identifier in
阅读全文
摘要:39.9. Trigger ProceduresPL/pgSQL can be used to define trigger procedures. A trigger procedure is created with the CREATE FUNCTION command, declaring it as a function with no arguments and a return type of trigger. Note that the function must be declared with no arguments even if it expects to recei
阅读全文
摘要:Return more than one row of data from PL/pgSQL functionsFrom PostgreSQL wikiJump to: navigation, searchby Stephan SzaboLast updated 4th April 2003 PostgreSQL 7.3 now supports a much more flexible system for writing set returning functions (SRFs) that when combined with some of the new function permi
阅读全文
摘要:http://blog.sciencenet.cn/home.php?mod=space&uid=419883&do=blog&id=537939
阅读全文
摘要:以下操作为windows32环境下官网:http://www.enterprisedb.com下载:http://get.enterprisedb.com/postgresql/postgresql-9.1.2-1-windows-binaries.zip以上是免安装版的,需要手动初始化及注册服务,步骤如下:1)解压到指定目录(用path表示)2)在path下新建存放数据的目录myData3)在bin目录运行以下命令初始化数据库:initdb.exe -D path\myDate -E UTF8 --locale=C(比如我的:initdb.exe -D D:\Development\pgsq
阅读全文
摘要:postgresql下存储过程的写法 在当前这个项目里(empress),我主要应用到了两种 服务端编程语言:扩展SQL中的查询语言函数(SQL)和PL/pgSQL SQL过程语言。前者仅包括了简单的sql语句,后者还包括了一些条件、循环控制等。这些函数都可以存放在文本中,使用\i命令导入到db中即可。首先是SQL的例子:create or replace function set_relation_done(integer, integer)returns void AS $$update relations set done=TRUE where userid=$1 andfriendid
阅读全文
摘要:今天学会了用 PL/pgSQL 写 postgreSQL 的存储过程,网上资料实在少得可怜,唯一能搜到的一些还是抄来抄去的;还是翻postgresql的文档吧,把今天解决的问题说一下吧,希望对其他人有帮助。问题是这样的,有一张message表:CREATE TABLE message( id int8 NOT NULL, receiveuserid int8, senduserid int8, receivedelete bool DEFAULT false, senddelete bool DEFAULT false, …… CONSTRAINT usermessage_pke...
阅读全文