Thread: Where is the logig to create a table file?

Where is the logig to create a table file?

From
"jacktby@gmail.com"
Date:
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



Re: Where is the logig to create a table file?

From
Pavel Borisov
Date:
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



Re: Where is the logig to create a table file?

From
Kyotaro Horiguchi
Date:
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