1、源代码下载与准备 PG 词法和语法解析分别使用 flex 和 yacc脚本,也就是源代码里能看到的 .l 和 .y 文件,由他们生成 .c 和 .
1、源代码下载与准备
PG 词法和语法解析分别使用 flex 和 yacc脚本,也就是源代码里能看到的 .l 和 .y 文件,由他们生成 .c 和 .h文件。
更详细资料见:
(很不幸,这个网站是无法直接访问的,自己想办法)
这两个工具在 Windows 下的环境一直没有彻底弄好,再加上考虑它们的版本,我都是在 Linux 下生成语法引擎,操作步骤见 (2)。
参考资料:《lex与yacc》机械工业出版社
(1) 下载打包好的包,这种方式的好处是不需用 flex和bison
下载地址:
国际社区
国内镜像 ftp://www.highgo.com.cn/pub/mirrors/pgsql/source/
进入第二步,不需要在 Linux 生成任何文件。
(2) clone社区 git 代码库,需要:git flex bison
关于git,它是一个强大到一套糊涂的代码管理工具,请自行了解使用方法,官方网站:
(仍然很不幸,自己想办法)
Windows下可以安装 Cygwin,选装 git 和 openssh,在 Cygwin 环境下使用 git。
官方网站:
需要注意的是,编译开关要一致,以下 a-e 步骤需要在 Linux 下执行。
a). 克隆代码库
git clone
b). 配置编译参数,可能需要安装一些开发包,根据错误提示安装即可
./configure --prefix=/usr/local/pg93b1 \
--enable-nls="zh_CN zh_TW" \
--without-perl \
--without-python \
--without-tcl \
--without-gssapi \
--without-krb5 \
--without-pam \
--without-ldap \
--without-bonjour \
--with-openssl \
--with-libxml --with-libxslt \
--enable-thread-safety \
--with-zlib \
--without-selinux
c). 编译内核
make
d). 编译外围模组
cd contrib & make
cd ..
e). 编译隔离测试脚本
cd src/test/isolation & make
f). 将如下文件拷贝至 Windows 下源代码的相同位置
src\backend\bootstrap\bootparse.c
src\backend\bootstrap\bootscanner.c
src\backend\parser\gram.c
src\backend\parser\gram.h
src\backend\parser\scan.c
src\backend\replication\repl_gram.c
src\backend\replication\repl_scanner.c
src\backend\utils\misc\guc-file.c
src\bin\psql\psqlscan.c
contrib\cube\cubeparse.c
contrib\cube\cubescan.c
contrib\seg\segparse.c
contrib\seg\segscan.c
src\interfaces\ecpg\preproc\pgc.c
src\interfaces\ecpg\preproc\preproc.c
src\interfaces\ecpg\preproc\preproc.h
src\pl\plpgsql\src\pl_gram.c
src\pl\plpgsql\src\pl_gram.h
src\test\isolation\specparse.c
src\test\isolation\specscanner.c
2、Windows 开发包的下载与准备
Windows下编译 PostgreSQL 所需开发包列表见文档 16.1.1. Requirements
下载 OpenSSL,这里很全。
ftp://ftp.zlatkovic.com/libxml/
这里也有 openssl,但版本较老。
从这里下载可以下载到 iconv、libxml2、libxslt、zlib,推荐使用
这里下载 gettext
文档提及的 上的包更新已经远远落后于 gnu,但仍然可用。
将下载的包解压到 c:\pgbuild 目录
3、微软VC 下载,express版对我们来说足够,还是免费授权。
安装完毕后,建议打好所有补丁。
4、修改 src\tools\msvc\config_default.pl,指向我们下载到的开发包
nls => "C:\\pgbuild\\gettext"
openssl => "C:\\pgbuild\\OpenSSL"
xml => "C:\\pgbuild\\libxml2"
xslt => "C:\\pgbuild\\libxslt"
iconv => "C:\\pgbuild\\iconv"
zlib => "C:\\pgbuild\\zlib"
6、下载 ActivePerl 并安装
7、打开 程序菜单 ”Microsoft Visual Studio 2010“ -> ”Visual Studio Tools“ -> ”Visual Studio Command Prompt (2010)“
如果是其他版本,注意是 32位的那个,没有把握可以看它的属性,vcvarsall.bat 后边有参数 x86。
set path=%path%;C:\pgbuild\iconv\bin;
set path=%path%C:\ActivePerl-5.12.x\bin;
set path=%path%C:\pgbuild\gettext\bin;
进入 PostgreSQL 源代码 src\tools\msvc 运行 build.bat
编译完毕后运行: install.bat
8、至此编译完成,但是有些 dll 文件需要手工拷贝,,根据文件缺失错误提示从第二步的开发包目录中查找。

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)