Re: Instructions for adding new catalog

Lists: pgsql-hackers
From: "Gustavo Tonini" <gustavotonini(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Instructions for adding new catalog
Date: 2008-08-01 13:51:42
Message-ID: 9c31dd0d0808010651q1079c4e0m6967cb8851df1de9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,
I read the archives, but I can't find the instructions for adding new
catalogs to the system.
Where can I find those instructions? Is there a document about this?

Thanks,
Gustavo.

P.S: Please CC to me on reply


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gustavo Tonini" <gustavotonini(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Instructions for adding new catalog
Date: 2008-08-01 14:28:19
Message-ID: 9506.1217600899@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Gustavo Tonini" <gustavotonini(at)gmail(dot)com> writes:
> I read the archives, but I can't find the instructions for adding new
> catalogs to the system.

That's probably because there aren't any. Look at recent patches
that added a new catalog to get an idea of what you need to do.
The enum patch might be a good choice.

regards, tom lane


From: "Gustavo Tonini" <gustavotonini(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Instructions for adding new catalog
Date: 2008-08-04 02:44:01
Message-ID: 9c31dd0d0808031944q80772e9l46153c4ab06fe49f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thanks for reply, Tom.
Well, just for documenting the process...
Adding new postgres catalog in 2 little steps:

1)Write catalog header file and save it into "src/include/catalog"
directory. Hint: copy format from other catalog headers.
2)Add your header file name to variable POSTGRES_BKI_SRCS in file
"src/backend/catalog/Makefile"

"Make", "make install", then "initdb" will create new system catalogs for you.

Gustavo.

On Fri, Aug 1, 2008 at 11:28 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Gustavo Tonini" <gustavotonini(at)gmail(dot)com> writes:
>> I read the archives, but I can't find the instructions for adding new
>> catalogs to the system.
>
> That's probably because there aren't any. Look at recent patches
> that added a new catalog to get an idea of what you need to do.
> The enum patch might be a good choice.
>
> regards, tom lane
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gustavo Tonini" <gustavotonini(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Instructions for adding new catalog
Date: 2008-08-04 03:04:12
Message-ID: 19575.1217819052@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Gustavo Tonini" <gustavotonini(at)gmail(dot)com> writes:
> Well, just for documenting the process...
> Adding new postgres catalog in 2 little steps:

> 1)Write catalog header file and save it into "src/include/catalog"
> directory. Hint: copy format from other catalog headers.
> 2)Add your header file name to variable POSTGRES_BKI_SRCS in file
> "src/backend/catalog/Makefile"

As long as we're documenting ...

* Documenting a new catalog in catalogs.sgml is not considered optional.
* Most likely, your catalog needs some indexes, which should be declared
in catalog/indexing.h.
* Of course, the reason you are defining a new system catalog is that
the C code is going to know about it. So there is a whole lot of
other stuff you probably need to write: object insertion code,
object deletion code, lookup code (maybe a new syscache or two).
Traditionally the lowest-level insertion/deletion code goes into
catalog/pg_yourcatalog.c, while slightly higher-level code such as
the implementation of new utility commands to manage this new kind
of object will go elsewhere.

That's before you get to any actual new functionality...

regards, tom lane