关于PostgreSql数据库和mysql的不同点及注意事项
一、数据类型:
1. update time (更新时间)
更新时间戳需要通过触发器来实现。
- 定义触发器
CREATE OR REPLACE FUNCTION "public"."cs_timestamp"()
RETURNS "pg_catalog"."trigger" AS $BODY$
begin
new.updated_time= current_timestamp;
return new;
end
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
- 创建触发器
create trigger cs_time before update on table1 for each row execute procedure cs_timestamp();
2. IN
dapper 判断了connection 是否是npgsql ,如果是,表示支持 数组类型,不展开数组。也就是 in @ids ,在npgsql下不做转化为 in (@p1,@p2…),故 在pgsql 下要用 any(@ids)
例如:
select * from tbl where id = any(@ids);
3. upsert
upsert是一个组合词,即当往表中插入记录,如果该记