Re: "Core" function in Postgres

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Mingzhe Li <mingzhe0908(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: "Core" function in Postgres
Date: 2014-09-24 13:59:39
Message-ID: CAHyXU0yjEGjeDMPiZm1K6igzAgeMt3R-rvpcW3wgMtOhZDXv3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 23, 2014 at 7:02 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Wed, Sep 24, 2014 at 8:29 AM, Mingzhe Li <mingzhe0908(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-09-24 14:06:30 Re: identify_locking_dependencies is broken for schema-only dumps
Previous Message Alvaro Herrera 2014-09-24 13:58:49 Re: make pg_controldata accept "-D dirname"