
postgresql
Henry_Wu001
这个作者很懒,什么都没留下…
展开
-
postgresql 触发器 时间时区问题
根据你的操作系统和安装方式的不同,该文件的位置可能会有所不同。一旦 PostgreSQL 数据库服务器的时区设置完成,它将在后续的数据库操作中使用该时区进行日期和时间计算。重新启动 PostgreSQL 服务器,以使新的时区设置生效。设置项的值修改为你想要设置的时区。时区的命名遵循 IANA 时区数据库的规范,可以使用短名称(例如。触发器的时间Now()用的是utc时间,和数据库入库中的时间相差8小时;如果你希望使用 UTC 作为时区,可以将设置项的值修改为。例如,要将时区设置为中国上海的时区,你可以将。原创 2023-10-30 16:47:09 · 525 阅读 · 0 评论 -
postgresql 使用lo模块扩展更方便操作
安装 lo 模块扩展CREATE EXTENSION lo;测试触发器作用CREATE TABLE image (title text, raster lo);CREATE TRIGGER t_raster BEFORE UPDATE OR DELETE ON image FOR EACH ROW EXECUTE FUNCTION lo_manage(raster);refsPostgreSQL: Documentation: 14: F.20.lo...原创 2022-05-12 13:17:39 · 460 阅读 · 0 评论 -
postgresql large object 读写
large object是除了jsonb和bytea外的另一种大文件保存方式;创建创建 inv_oid = lo_creat(-1);“-1” 参数创建新的空的大对象,返回oid,SELECT lo_creat(-1);默认PostgreSQL会随机创建一个oid,也可以自己指定一个作为参数.如下是尝试用31321创建大对象SELECT lo_create (31321);打开-- INV_READ = 0x20000-- INV_WRITE = 0x40原创 2022-05-11 19:10:02 · 670 阅读 · 0 评论 -
postgresql trigger
1)要先创建trigger方法;用new,old代替原来(sqlserver)的inserted等;CREATE OR REPLACE FUNCTION "public"."update_etor_ticket_bianhao"() RETURNS "pg_catalog"."trigger" AS $BODY$declare strdate varchar;strId varchar;sid int;BEGIN -- type your statements heres..原创 2022-05-12 13:18:38 · 514 阅读 · 0 评论 -
how to get the dbContext is always new when call the grain
Q:version info:Orleans : 2.3.0EF Core:2.2.3services.AddDbContextPool<TestContext>(options =>{ options.UseSqlServer("");}); public class TestGrain : Grain,ITest { private TestContext _testContext; public TestGra转载 2021-06-19 13:49:06 · 250 阅读 · 0 评论 -
postgresql-timescaldb_extention
1)postgresql下载安装https://www.postgresql.org/download/现在都zhuan原创 2021-06-19 08:04:17 · 270 阅读 · 1 评论 -
ubuntu 安装pgagent,并配置job
https://www.pgadmin.org/docs/pgadmin4/development/pgagent_jobs.html1)安装sudo apt install pgagent2)创建db扩展psql -U postgres -h localhostCREATE EXTENSION pgagent;3)启动在postgres数据库上启用pgagent:pgagent hostaddr=127.0.0.1 dbname=postgres...原创 2020-12-01 10:53:47 · 797 阅读 · 0 评论 -
postgresql加装timescaledb扩展
refs:https://docs.timescale.com/v1.2/getting-started/setup大部分来着官方文档,请直接去官方网站查看,此处仅作个人记录。1)在已经安装好postgresql数据库下安装扩展:# Connect to PostgreSQL, using a superuser named 'postgres'psql -U postgres -h localhost-- Now create a new empty database (.原创 2020-08-10 16:01:01 · 1280 阅读 · 0 评论 -
postgresql 表拷贝后序列号出现重置状态
拷贝并修改了表,后数据添加时提示主键已经存在,重新设置后 sequence后解决。 at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection) Exception data: Severity: ERROR SqlState: 23505 MessageText: duplicate key valu...原创 2020-07-29 15:27:02 · 529 阅读 · 0 评论 -
postgresql更新timestamp栏位
refs:https://www.dbrnd.com/2018/04/postgresql-get-the-milliseconds-from-the-timestamp/https://stackoverflow.com/questions/23950025/how-to-write-bigint-timestamp-in-milliseconds-value-as-timestamp-in-postgresql有一栏数据他的时间戳是错误的,想按次序更新下时间戳。原数据:.原创 2020-07-27 17:07:45 · 506 阅读 · 0 评论 -
how to use .query attribute in sqlacodegen models
refs:https://stackoverflow.com/questions/28023444/how-to-use-query-attribute-in-sqlacodegen-modelsWhen I use sqlacodegen to create models.py I can't use User.query, getting the warning "[AttributeError: type object 'User' has no attribute 'query']"..转载 2020-07-12 22:44:32 · 220 阅读 · 0 评论 -
postgresql 表拷贝后出现duplicate key问题
Q:rtA:原因是表中的id是序列化的id,由于拷贝或其他操作导致重置?二表中已经有数据存在了,所以才会导致重键。Solution1:因为是测试表,所以清除了表中的数据;Solution2:重新设置sequence 栏位的值。如下:truncate bad_users restart identity;...原创 2020-07-10 11:40:59 · 1202 阅读 · 0 评论 -
Code-First Database Design with Entity Framework and PostgreSQL
Entity Framework is an Object-Relational Mapper for .NET applications, and the code-first approach using Entity Framework allows developers to use their domain model to build and query databases direc...转载 2020-04-21 16:10:53 · 932 阅读 · 0 评论 -
How to Migrate from Microsoft SQL Server to PostgreSQL
One of our clients had a Java-based application stack on Linux that connected to a pretty old version of SQL Server on Windows. We wanted to migrate the entire system to a more consistent unified sta...转载 2020-03-30 16:12:42 · 888 阅读 · 0 评论 -
entityframework 和 postgreslq
Refs:https://www.cnblogs.com/fonour/p/5886292.htmlhttps://www.cnblogs.com/joeymary/p/9032825.htmlPackage 序号 Package 说明 1...原创 2020-03-10 21:13:17 · 202 阅读 · 0 评论 -
TimescaleDB用法简介
refs:https://labs.consol.de/development/2018/10/31/introduction-to-timescale-db.htmlOur world is full of various processes: tracking of goods delivery, currencies trading, monitoring of server ...转载 2020-01-13 16:19:08 · 2519 阅读 · 0 评论 -
Migrating from MSSQL to PostgreSQL - What You Should Know
As you may know, Microsoft SQL Server is very popular RDBMS with highly restrictive licencing and high cost of ownership if the database is of significant size, or is used by a significant number of c...转载 2019-08-28 14:42:29 · 432 阅读 · 0 评论 -
postgresql 安装配置
1.安装步骤:https://www.postgresql.org/download/linux/ubuntu/2.安装好后打开防火墙对应端口sudo ufw allow 54323.修改配置允许外部访问/etc/postgresql/11/main/postgresql.conf修改其中listen部分,'localhost' ==>'*'...原创 2019-08-21 16:44:03 · 178 阅读 · 0 评论