postgres/postgres
Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we don't work with pull requests on github. To contribute, please see https://wiki.postgresql.org/wiki/Submitting_a_Patch
postgres/postgres
Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we don't work with pull requests on github. To contribute, please see https://wiki.postgresql.org/wiki/Submitting_a_Patch
PostgreSQL 是全球使用最广泛的开源对象关系型数据库管理系统(ORDBMS)之一,由全球开发者社区持续维护三十余年。本 GitHub 仓库为官方 Git 源码镜像,涵盖完整数据库内核与 C 语言绑定;生产环境通常优先使用 postgresql.org 提供的二进制包,而非直接编译镜像仓库。需要向项目贡献代码时,请遵循 PostgreSQL 官方补丁提交流程,本镜像不接受 Pull Request。
PostgreSQL 把关系模型的严谨性与现代数据类型、扩展机制结合,既能承载传统 OLTP 业务,也能支撑分析查询、GIS 与 AI 向量检索等混合负载。BSD 风格的 PostgreSQL License 允许商业部署与二次分发,社区文档、托管厂商与 ORM 生态极为成熟。对团队而言,它是 MySQL 之外最常被选中的「默认严肃数据库」,也是云厂商托管数据库(RDS、Cloud SQL 等)的常见底层引擎。
macOS(Homebrew,推荐日常开发)
brew install postgresql@17brew services start postgresql@17Debian / Ubuntu(系统包)
sudo apt updatesudo apt install postgresql postgresql-contribsudo systemctl enable --now postgresql从本仓库源码构建(开发/定制编译)
git clone https://github.com/postgres/postgres.gitcd postgres./configuremakesudo make install使用包管理器安装后,通常已有 postgres 系统用户与默认集群。创建数据库与用户示例:
sudo -u postgres psql -c "CREATE USER myapp WITH PASSWORD 'secret';"sudo -u postgres psql -c "CREATE DATABASE myapp OWNER myapp;"psql -h localhost -U myapp -d myapp源码安装后需按文档执行 initdb 初始化数据目录,再启动 postgres 进程。
psql -c "SELECT version();"psql -c "CREATE TABLE t(id serial PRIMARY KEY, payload jsonb); INSERT INTO t(payload) VALUES('{\"ok\": true}'); SELECT * FROM t;"能返回版本号并成功读写即表示核心功能正常。
pg_upgrade 或逻辑迁移;PostGIS、pgvector 等扩展需匹配 PostgreSQL 主版本。pg_hba.conf 可能仅允许本地 peer 认证;远程访问需显式配置 host 规则与防火墙。pg_dump/物理备份、监控连接数与慢查询,并在大版本发布前阅读 Release Notes。