Where is the logig to create a table file?

Started by jacktby@gmail.comalmost 3 years ago3 messages
#1jacktby@gmail.com
jacktby@gmail.com

When I use 'create table t(a int);'; suppose that this table t's oid is 1200,
then postgres will create a file named 1200 in the $PGDATA/base, So where
is the logic code in the internal?

--------------

jacktby@gmail.com

#2Pavel Borisov
pashkin.elfe@gmail.com
In reply to: jacktby@gmail.com (#1)
Re: Where is the logig to create a table file?

Hi, Jack

On Fri, 3 Feb 2023 at 13:19, jacktby@gmail.com <jacktby@gmail.com> wrote:

When I use 'create table t(a int);'; suppose that this table t's oid is 1200,
then postgres will create a file named 1200 in the $PGDATA/base, So where
is the logic code in the internal?

heapam_relation_set_new_filenode()->RelationCreateStorage()

Kind regards,
Pavel Borisov,
Supabase

#3Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Pavel Borisov (#2)
Re: Where is the logig to create a table file?

At Fri, 3 Feb 2023 13:44:46 +0400, Pavel Borisov <pashkin.elfe@gmail.com> wrote in

Hi, Jack

On Fri, 3 Feb 2023 at 13:19, jacktby@gmail.com <jacktby@gmail.com> wrote:

When I use 'create table t(a int);'; suppose that this table t's oid is 1200,
then postgres will create a file named 1200 in the $PGDATA/base, So where
is the logic code in the internal?

heapam_relation_set_new_filenode()->RelationCreateStorage()

Or if you are searching for the logic to determin the file name, see
GetNewRelFileNumber().

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center