Windows under source installation debug PostgreSQL

Source: Internet
Author: User
Tags diff postgresql

Environment: Windows Ten

PostgreSQL version: postgresql-9.6.5

Using tools: vs2017 Community Edition

Accessibility Tools: Perl , diff , Flex , Bison

Related tools:

Perl Download Link: Http://pan.baidu.com/s/1i5aPilB Password: k6f0

diff , Flex , Bison Download Link: http://pan.baidu.com/s/1hrHotes Password: 4ku6

The above tools are green version, after decompression, set environment variables can be

the compilation debugging tool used here is vs2017 Community Edition, this version is free version, personal use does not exist copyright obsession.

Download offline First vs2017 Community Edition, can also be installed online, the installation method is as follows:

Official download tool for Microsoft Official downloads: vs_community.exe

cmd execute the following command in the ZH-CN represents Chinese, en -US Speak English, E:\vs2017 indicates the download location:

vs_community.exe--layout E:\vs2017 offline--lang ZH-CN

installation vs2017 , select the following to install:

Modify PostgreSQL configuration file, or the compilation process will cause an error. The contents of the amendment are as follows:

E:\PG\postgresql_9.6.5\src\tools\msvc\VSObjectFactory.pm , set the if ($major >) "Modify to" if ($major >) ", as shown below:

E:\PG\postgresql_9.6.5\src\tools\msvc\Mkvcbuild.pm will " My $vsVersion = Determinevisualstudioversion (); "Modify to" my $vsVersion = ' 14.00 '; "as shown in:

above two steps to resolve pg perl script does not recognize vs2017 version of the problem, the error message is " unable to determine VisualStudio Version:the NMAKE version could not be determined. ATSRC/TOOLS/MSVC/MKVCBUILD.PM line. "

with vs Open File " E:\PG\postgresql_9.6.5\src\fe_utils\print.c , do the following:

then save to replace the original file. Problem solved here: the newline characters in this file use the line breaks that are common to each operating system, and a warning appears under Windows compilation. The error message is "warning C4819:the filecontains A character that cannot being represented in the current code page (936). Save the file in Unicode format to prevent data loss"

compile below PostgreSQL Source:

then execute the cd/d E:\PG\postgresql_9.6.5\src\tools\msvc "Switch to PG source Path, execute command " Perl build.pl DEBUG "Here for easy commissioning use DEBUG mode, the compilation time will be more than Linux to be long, after the compilation is complete, the following:

once the compilation is complete, you can perform the " perl vcregress.pl Check "Run the regression test and the results are as follows:

after confirming the error, execute the " Perl install.pl E:\pg\pgdb "For installation, the installation results are as follows:

then go to PG installation directory" cd/d E:\pg\pgdb " to build the library operation " initdb.exe-d. /data ", when the library is complete, start the PG database " pg_ctl.exe -D: /data-llogfile start "to enter the database after startup is complete" psql-d postgres "

If you need to use vs debug pg , first pg Code Use vs Open, open with, find the compiled folder e:\pg\postgresql_9.6.5 , open File pgsql.sln "The following prompt appears because of the use of vs2015 The compiler compiles the and does not redirect the items to the following options:

when you are sure, you can use vs Open PG source code. Then determine The process ID of the currently open PG:

Click Attach to attach to the process.

Try Debugging

at this PG waiting for input, through the stack information can be seen to wait for the status of network messages, and finally stop in the function " WaitForMultipleObjects "

use breakpoint debugging, for example, in PG Error entry function under Breakpoint,

As follows

then execute the wrong SQL statement:

table does not exist in the database AAAA , at this time vs The status is as follows:

the stack information above is PG Execution Error SQL the function that is used when the

Windows under source installation debug PostgreSQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.