-
Spring Boot MyBatis 将 PostgreSQL 数组转为 Java List
类型处理器 @MappedJdbcTypes({JdbcType.ARRAY}) @MappedTypes({Object.class}) public class ListTypeHandler
2024-05-20, Views: 706 , Topics: MyBatis PostgreSQL Spring Boot
-
Spring Boot MyBatis PostgreSQL Cannot convert the column of type TIMESTAMPTZ to requested type java.time.LocalDateTime
错误信息 Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Req
2024-04-18, Views: 1413 , Topics: Spring Boot MyBatis PostgreSQL
-
PostgreSQL 16 编译安装
说明 以CentOS 8为例。 安装依赖 libxslt yum install libxslt-devel readline yum install readline-devel zlib y
2024-03-15, Views: 988 , Topics: PostgreSQL
-
PostgreSQL 删除数据库时报错 ERROR: database "test" is being accessed by other users
错误信息 查询出错 (7): ERROR: database "test" is being accessed by other users DETAIL: T
2024-03-14, Views: 561 , Topics: PostgreSQL
-
PostgreSQL 覆盖索引添加额外字段信息
场景 user表中,有username唯一索引列。 当我们从user表中查找id时,数据库只需一次查询(这里的只查询一次,指的是:数据库内部只从索引就能获取需要
2023-11-22, Views: 539 , Topics: PostgreSQL
-
PostgreSQL 批量更新
SQL 使用临时表实现批量更新 UPDATE sys_user SET username = tmp.username FROM (VALUES
2023-11-21, Views: 730 , Topics: PostgreSQL
-
PostgreSQL 逻辑删除保证数据唯一
场景 有用户表(username,del_flag),保证用户名唯一。 方案一 username唯一索引,逻辑删除后不能再新建相同名称的用户。 方案二 user
2023-11-20, Views: 601 , Topics: PostgreSQL
-
PostgreSQL 数组中是否存在某个元素
存在 select * from post where 'Java' = ANY(topics_arr); 不存在 select * from post whe
2023-11-17, Views: 698 , Topics: PostgreSQL
-
PostgreSQL 转义特殊字符
E'' select E'$\abcd', E'abcd\''; 输出 postgres=# select E'$\abcd', E'abcd\''; ?co
2023-11-16, Views: 1087 , Topics: PostgreSQL
-
PostgreSQL 查询当前文章以及上一篇文章和下一篇文章
需求 查询出当前博客文章的上一篇和下一篇文章,显示在当前博客的尾部。 数据准备 create table if not exists article(id in
2023-11-15, Views: 597 , Topics: PostgreSQL
-
PostgreSQL 实现 upsert 插入或者更新功能
需求 实现insert or update功能,也称upsert。 即:记录如果不存在就插入,记录如果存在就更新。 语法 使用insert on conflic
2023-11-14, Views: 965 , Topics: PostgreSQL
-
PostgreSQL for update skip locked 实现队列功能
数据准备 create table if not exists queue(id int, content text, status text); insert
2023-11-13, Views: 987 , Topics: PostgreSQL
-
PostgreSQL timestamp 字段转换时区
关键字 at time zone 查看当前数据库默认时区 显示UTC时区。 show time zone; 输出 lite_note=# show time z
2023-11-12, Views: 735 , Topics: PostgreSQL
-
PostgreSQL timestamp 与 timestamptz 区别
相同点 都占用8字节。 存储时没有本质区别,都不携带时区信息。 不同点 insert returning和select时返回给客户端数据时不同。 inse
2023-11-11, Views: 937 , Topics: PostgreSQL Java
-
PostgreSQL 查询连续登录超过 7 天的用户
数据准备 create table login_log(id varchar(255), log_time date); INSERT INTO login_l
2023-11-10, Views: 612 , Topics: PostgreSQL
-
PostgreSQL 实现历史上的今天
需求 博客中需要展示一个同月同日发布的文章列表功能。 实现 其中create_ts是timestamptz类型。 select * from post wher
2023-11-09, Views: 556 , Topics: PostgreSQL
-
PostgreSQL 判断字符串中是否含有指定字符
正则表达式 使用~符号,A ~ B表示:A中是否包含B。 返回值类型:boolean。 示例:查询test_column列中的值包含abc字符串的记录。 sel
2023-11-08, Views: 1014 , Topics: PostgreSQL
-
PostgreSQL FETCH FIRST ROWS WITH TIES 查询成绩排名并列前三名的学生
FETCH FIRST ROWS WITH TIES 实现Top N功能。 数据准备 create table if not exists score(name
2023-11-07, Views: 579 , Topics: PostgreSQL
-
PostgreSQL 判断字符串是否以指定文字开头
starts_with 语法 starts_with(字段, '指定文字') 示例 select * from pg_settings where starts
2023-11-06, Views: 1411 , Topics: PostgreSQL
-
PostgreSQL 判断条件 is not null 和 != null 的区别
!= null 相当于 select * from book where null; 判断是否为 null 所有关系型数据库都是通过is null和is not
2023-11-03, Views: 759 , Topics: PostgreSQL