-
macOS Postgres.app 配置命令行工具
执行命令 执行完成后需重新打开终端。 sudo mkdir -p /etc/paths.d && echo /Applications/Post
2023-05-22,阅读:57,标签:macOS PostgreSQL
-
Docker 部署 PostgreSQL
搜索镜像 docker search postgres 拉取镜像 版本号可以去官网查看:https://hub.docker.com/_/postgres do
2022-02-06,阅读:1037,标签:Docker PostgreSQL DevOps
-
PostgreSQL 重置序列序号
从 1 开始 false表示,数字1还没有被用掉。 select setval('post_id_seq', 1, false); 从 2 开始 true表示,
2021-05-18,阅读:1427,标签:PostgreSQL
-
PostgreSQL 修改字段属性
重命名 alter table record_page_view rename ua to user_agent; 添加字段 alter table reco
2021-05-17,阅读:2246,标签:PostgreSQL
-
PostgreSQL 时间戳转毫秒值并去除小数位
时间戳转毫秒值 使用extract函数及epoch from关键词。 select extract(epoch from (current_timestamp)
2021-05-16,阅读:4636,标签:PostgreSQL
-
Linux 编译安装 PostgreSQL
下载地址 清华大学镜像,下载并解压。 wget https://mirrors.tuna.tsinghua.edu.cn/postgresql/source/v
2021-05-15,阅读:1534,标签:PostgreSQL Linux
-
PostgreSQL distinct 和 distinct on 区别
数据 city空值的为null z-blog=# select city, id, ip from ip_pool; city | id |
2021-01-05,阅读:1551,标签:PostgreSQL
-
PostgreSQL update from 根据 A 表更新 B 表
准备工作 -- 创建表1 create table t1(id integer, name text); -- 创建表2 create table t2(id
2021-01-04,阅读:3132,标签:PostgreSQL
-
PostgreSQL 查询表中的自增序列名称
SQL 使用pg_get_serial_sequence函数,第一个参数为需要查询的表,第二个参数为自增的列。 select pg_get_serial_seq
2020-12-31,阅读:4286,标签:PostgreSQL
-
PostgreSQL 查看时区
查看当前时区 show timezone; 或者 show time zone; 查看内置时区 所有时区 select * from pg_timezone_n
2020-12-30,阅读:7350,标签:PostgreSQL
-
PostgreSQL 错误: 编码 "UTF8" 的字符 0x0xc9 0x99 在编码 "GBK" 没有相对应值
问题描述 在Windows的PowerShell中使用psql查询记录时抛出如下异常。 错误: 编码"UTF8"的字符0x0xc9 0x99在编码"GBK"没
2020-12-17,阅读:5778,标签:PostgreSQL PowerShell chcp
-
PostgreSQL 获取本月第一天时间戳等信息
date_trunc 日期函数中适用的时间字段 second minute day hour day week month quarter year 当天零
2020-12-16,阅读:4416,标签:PostgreSQL
-
PostgreSQL duplicate key violates unique constraint
错误原因 当前序列的值小于了目前表中的值。 查看序列 select * from post_id_seq; 输出 last_value | log_cnt |
2020-12-15,阅读:1817,标签:PostgreSQL
-
Go 操作 PostgreSQL
下载驱动 使用github.com/lib/pq驱动:https://github.com/lib/pq go get -u github.com/lib/pq
2020-11-10,阅读:3505,标签:Go PostgreSQL
-
使用 MyBatis 注解接收 PostgreSQL 的 returning 结果
returning PostgreSQL支持在insert/update/delete语句中添加returning返回一些记录的信息。 如:插入记录后返回主键i
2020-04-25,阅读:4176,标签:MyBatis PostgreSQL
-
PostgreSQL 备份与还原
备份 - pg_dump 参数 -U:指定用户; --encoding:指定编码; -d、--dbname:指定备份数据库; -f、--file:导出到指定文
2020-04-18,阅读:4845,标签:PostgreSQL
-
PostgreSQL增删改使用 returning 获取记录相关属性
returning 增删改时返回该记录的属性。 示例 returning * 插入时返回记录的所有字段 insert into test(test_filed1
2020-03-31,阅读:2097,标签:PostgreSQL
-
PostgreSQL 统计数组中的元素个数
需求 统计文章表中的标签数组字段中的不同分类个数。 表字段 使用\d+ post查看。 z-blog=# \d+ post
2020-03-26,阅读:5838,标签:PostgreSQL
-
PostgreSQL 修改数据库拥有者
查看拥有者 z-blog=# \l 数据库列表 名
2020-03-25,阅读:3024,标签:PostgreSQL
-
PostgreSQL 对数组字段增删改查
增 添加一个元素 例:向文章标签字段尾部添加abc这个标签。 update post set topics = array_append(topics, 'ab
2020-03-22,阅读:5274,标签:PostgreSQL