PostgreSQL
PostgreSQL 日常记录
慌途L
随手记录,错误之处敬请指出。
展开
-
Docker拉取PostgreSQL(PGSQL)镜像并启动容器
1.拉取镜像docker pull postgres查看镜像:docker images2.启动容器docker run --name pg -e POSTGRES_PASSWORD=123456 -e POSTGRES_USER=postgres -p 5432:5432 -d postgres:latest查看容器运行中的:docker ps原创 2021-05-24 15:25:02 · 2613 阅读 · 0 评论 -
PostgreSQL | 生成UUID 报错:HINT: No function matches the given name and argument types
在PG数据库上新建表结构:CREATE TABLE "public"."t_test" ( "guid" uuid NOT NULL DEFAULT uuid_generate_v4(), "data" jsonb, "create_time" timestamptz(6) DEFAULT now(), CONSTRAINT "test_pkey" PRIMARY KEY ("guid"));报错:ERROR: function uuid_generate_v4() does转载 2020-11-25 18:16:09 · 10118 阅读 · 0 评论 -
PostgreSQL踩坑 | ERROR: operator does not exist: uuid = character varying
业务场景:在MyBatis中对Postgresql数据库的表数据进行update操作,报以下错误:Caused by: org.postgresql.util.PSQLException: ERROR: column “data” is of type jsonb but expression is of type character varying建议:You will need to rewrite or cast the expression.Caused by: org.postg原创 2020-10-27 20:01:41 · 8167 阅读 · 0 评论 -
PostgreSQL | 将 timestamptz 格式的UTC时间转换成北京时间
PostgreSQL | 将 timestamptz 格式的UTC时间转换成北京时间1.将UTC时间"2020-08-25 02:11:34.59741+00" 转换成北京时间(yyyy-MM-dd HH:mm:ss)select to_char('2020-08-25 02:11:34.59741+00' AT TIME ZONE 'UTC-8','YYYY-MM-DD hh24:mi:ss') 结果:2.将时间"2020-08-25 02:11:34.59741+00" 转换成北京时间(原创 2020-10-15 19:02:41 · 4964 阅读 · 0 评论