Re: "Core" function in Postgres - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: "Core" function in Postgres
Date
Msg-id CAHyXU0yjEGjeDMPiZm1K6igzAgeMt3R-rvpcW3wgMtOhZDXv3w@mail.gmail.com
Whole thread Raw
In response to Re: "Core" function in Postgres  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Tue, Sep 23, 2014 at 7:02 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, Sep 24, 2014 at 8:29 AM, Mingzhe Li <mingzhe0908@gmail.com> wrote:
>> Hi experts,
>>
>> I want to know what's the "core" function used in Postgres server? I am
>> looking for something corresponding to main() in a simple C program. I want
>> to know the file path and the function name. I am using Postgres 9.3.5,
>> however I assume the "core" function will be unchanged between different
>> revisions.
>
> In your question, it seems that you are looking for the main() call
> for the binary postgres, which is located in src/backend/main/main.c.
> At the bottom of main() you'll see as well a set of functions like
> PostmasterMain or PostgresMain that really define the startup path
> used. PostmasterMain for example starts the postmaster, that is then
> able to itself start backend process through PostgresMain()...

As noted main is in main.c.  Most of the interesting stuff that
happens in the main execution loop for the backend is in
tcop/postgres.c (tcop being shorthand for 'traffic cop' -- probably
not a great name but it hails from the very early days of the
project).  That kinda answers your other question: these function
names rarely change except as needed to meet new requirements.

merlin



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: make pg_controldata accept "-D dirname"
Next
From: Robert Haas
Date:
Subject: Re: identify_locking_dependencies is broken for schema-only dumps