postgres

3、postgres时间计算函数date_part

[TOC] # postgres时间计算函数date_part ## 1、计量两个时间相隔天数 ```sql select date_part('day',endDate-startDate); ``` 实例: ```sql select date_part('day',to_date('20220 ......
函数 date_part postgres 时间 date

使用Debezium、Postgres和Kafka进行数据实时采集(CDC)

使用Debezium、Postgres和Kafka进行数据实时采集(CDC) 码匠君 2021-07-18 16:481994 1. 背景 一直在完善自己的微服务架构,其中包含分布式工作流服务的建设,目前采用的是Camunda工作流引擎。使用Camunda工作流,就会涉及到工作流引擎的用户体系如何与 ......
实时 Debezium Postgres 数据 Kafka

postgres设置远程访问

vi /opt/pg14.5/data/pg_hba.conf host all all 0.0.0.0/0 md5 编辑postgresql.conf,修改如下参数: listen_addresses = '*' 重启数据库 ......
postgres

Postgres LISTEN / NOTIFY with Node.js

#### Postgres 在 9.1 之后推出 LISTEN / NOTIFY #### 创建一个数据表 foo ``` CREATE TABLE foo (id serial primary key, name varchar); ``` #### 创建一个 存贮过程 ``` CREATE FU ......
Postgres LISTEN NOTIFY Node with

1、postgres数据导出

[TOC] # postgres数据导出 ## 1、只导出所有对象的数据库结构 ```shell pg_dump -f user_export.sql -i -C -E UTF8 -n myschema -s -U mypguser -h localhost -W mypostgres ``` ** ......
postgres 数据

2、postgres数据导入

[TOC] # postgres数据导入 ## 1、数据导入 ```shell psql -f user_export.sql -h localhost -U mypguser -W mypostgres ``` **参数说明:** -f 读取的sql文件 -h 导入的ip地址 -U 导入的用户 - ......
postgres 数据

1、postgres删除与创建schema

[TOC] # postgres删除与创建schema ## 1、删除schema语法 ```sql drop schema [schema_name]; ``` 或者 ```sql drop schema [if exists] [schema_name] [cascade] [restrict] ......
postgres schema

6、oracle迁移到postgres-分页问题

[TOC] # oracle迁移到postgres-分页问题 ## 1、oracle使用`rownum`进行分页 ```sql select * from ss_stu where rownum <= 10; ``` ## 2、postgres使用`limit`进行分页 ```sql select ......
postgres oracle 问题

2、oracle迁移到postgres-事务提交方式不同

[TOC] # oracle迁移到postgres-事务提交方式不同 ## 1、oracle oracle默认不自动提交事务,需要手动`commit` ## 2、postgres postgres默认自动提交事务,不需要手动`commit`,导致迁移过来的pck如果有`commit`需要注释掉 ......
postgres 事务 方式 oracle

1、oracle迁移到postgres-执行sql方式execute不同

[TOC] # oracle迁移到postgres-执行sql方式execute不同 ## 1、oracle使用`execute immediate` ```sql execute immediate 'sql'; ``` ## 2、postgres使用`execute` ```sql execut ......
postgres execute 方式 oracle sql

3、oracle迁移到postgres-执行动态sql传参不同

[TOC] # oracle迁移到postgres-执行动态sql传参不同 在sql字符串中,会动态传入值,使用阿拉伯数据定义传参的个数。 ## 1、oracle使用的是`:1` ```sql execute immediate 'select * from sys_stu where stu_na ......
postgres 动态 oracle sql

4、oracle迁移到postgres-oracle中使用的`decode`函数使用`case when`统一语法

[TOC] # oracle迁移到postgres-oracle中使用的`decode`函数使用`case when`统一语法 oracle中也有使用`case when`语法,使用`decode`函数比较简洁。 ## 1、oracle的`decode`语法 匹配`stu_type`为`1`的值的班 ......

5、oracle迁移到postgres-oracle中使用的`nvl`函数更改为统一的`coalesce`函数

[TOC] # oracle迁移到postgres-oracle中使用的`nvl`函数更改为统一的`coalesce`函数 `nvl`函数与`coalesce`函数都是值非空时,给默认值,oracle中也存在`coalesce`函数 ## 1、oracle的`nvl`函数 当成绩为空时,默认是0 ` ......

centos7离线安装postgres

官网下载源码包 https://www.postgresql.org/ftp/source/v12.10/ postgresql-12.10.tar.gz 上传到/usr/local目录 tar -zxvf postgresql-12.10.tar.gz 解压文件 cd postgresql-12. ......
postgres centos7 centos

postgres do body定义二维数组

customFieldLabels varchar[][] := '{ {"a","b", NULL}, {"a","b", "NULL"} }'::varchar[][]; 是string[][],所以{"a", "b"}是用了双引号的,当然也可以都不用双引号,但是不用的话NULL值就不好处理,字 ......
数组 postgres body do

Mac 安装 postgres

#### 安装 ``` arch -arm64 brew install postgresql ``` #### 初始化数据库 ``` initdb --locale=C -E UTF-8 /opt/homebrew/var/postgres ``` #### 启动服务 ``` brew servi ......
postgres Mac

全方位对比 Postgres 和 MySQL(2023 版)

根据 2023 年的 Stack Overflow 调研 (https://survey.stackoverflow.co/2023/) ,Postgres 已经取代 MySQL 成为最受敬仰和渴望 (the most admired, desired) 的数据库。 随着 Postgres 的发展势 ......
全方位 Postgres MySQL 2023

数据库操作系列-Mysql, Postgres常用sql语句总结

[toc] ## 1.如果我想要写一句sql语句,实现 如果存在则更新,否则就插入新数据,如何解决? ### MySQL数据库实现方案: ON DUPLICATE KEY UPDATE 在MySQL数据库中,如果在insert语句后面带上ON DUPLICATE KEY UPDATE 子句,而要插入 ......
语句 Postgres 常用 数据库 数据

win10 postgres initdb fail

Problem running post-install step. Installation may not complete correctlty. The database cluster initialisation failed. 解决方法:手动init db data directory ......
postgres initdb fail win 10

sudo su - postgres 是什么意思?

解释 PostgreSQL 安装成功之后,会默认创建一个名为 postgres 的 Linux 用户。 从 root 用户切换为 postgres 用户命令为su postgres,但是这样切换用户会导致该用户的权限很低,所以使用sudo su postgres设置 postgres 用户拥有部分 ......
postgres 意思 sudo su

Postgres学习笔记-Sequence自增序列

> Sequence: 根据指定的规范生成整数序列 ## ## 创建序列 ```sql CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ] [ MINVALUE minvalue | NO MINVALUE ......
序列 Postgres Sequence 笔记

arcgis注册postgresql失败。postgres be sure the databse client software is installed and configured correct

解决: 将PostgreSQL\9.1\bin目录下的Libpq.dll,Libeay32.dll, Libintl-8.dll, Ssleay32.dll复制一份放在ArcGIS Server安装目录的Server\bin***意:这里拷贝的文件需要都是64位的。 重启arcgis server服 ......

postgres db 迁移

参考文档: https://blog.csdn.net/qq_42346659/article/details/127182987 ## 备份 完全备份 ``` su - postgres $ pg_dumpall >pg_all.sql ``` ## 恢复 ``` su - postgres ps ......
postgres db

postgres 常用命令

## 查看 查看所有数据库大小 ``` SELECT datname AS database_name, pg_size_pretty(pg_database_size(datname)) AS database_size FROM pg_database; ``` 查看数据库中 所有表的大小 `` ......
postgres 命令 常用

全方位对比 Postgres 和 MySQL (2023 版)

全方位对比 Postgres 和 MySQL (2023 版) 原创 Bytebase 昨天 10:36 阅读数 9.4K 本文被收录于专区 数据库 进入专区参与更多专题讨论 根据 2023 年 Stack Overflow 调研,Postgres 已经取代 MySQL 成为最受敬仰和渴望的数据库。 ......
全方位 Postgres MySQL 2023

java判断postgres数据库集群的master节点

1.引入依赖 <!--postgresql--> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.2.2</version> </dependency> 2. ......
节点 集群 postgres 数据库 数据

群晖DSM 7.2 安装 postgres 数据库与 pgadmin4

## postgres ### 获取postgres 镜像 ``` postgres:15.2 ``` ### 创建挂在的文件夹 进入/volume1/docker/文件夹创建postgres 所需文件夹 ``` cxloge@synocxloge:~$ cd /volume1/docker/ cx ......
postgres pgadmin4 pgadmin 数据库 数据

postgres

10.67 su - app docker pull postgres:12.15 docker run -d --name pgsql12 -p 5432:5432 -e "POSTGRES_PASSWORD=123456" postgres:12.15 psql --host=192.168.1 ......
postgres

Mybatis postgres 使用汇总

# ? 区别 #{} 使用#{}意味着使用的预编译的语句,即在使用jdbc时的preparedStatement,sql语句中如果存在参数则会使用?作占位符,我们知道这种方式可以防止sql注入,并且在使用#{}时形成的sql语句,已经带有引号,例,select * from table1 where ......
postgres Mybatis

postgres数据库基础操作

[toc] # 1. 链接数据库 - 命令 ```shell /# PGPASSWORD=liubei@161 psql -U liubei -d xishu ``` 当然你也可以交互式输入密码 ```shell psql -U liubei -d xishu ``` - 输出 ```shell p ......
postgres 数据库 基础 数据