Thread: adding fields to pg_database

adding fields to pg_database

From
Markus Schiltknecht
Date:
Hi,

I'm trying to add fields to pg_database in the system catalog. As long
as I add fixed-size fields before the VAR LENGTH ones, that's all fine.

But adding a VAR LENGTH (text) field initdb fails at: copying template1
to template0. The child process 'postgres' fails with signal 11. Strange
enough I suspect the segfault to occure at program termination (?). That
is just after the following initdb commands have been executed:


...

"REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n",
"REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n",

/** Finally vacuum to clean up dead rows in pg_database*/
"VACUUM FULL pg_database;\n",


I've only added the fields in include/catalog/pg_database.h. Do I need
to fiddle other places?

Regards

Markus




Re: adding fields to pg_database

From
"Jonah H. Harris"
Date:
On 4/11/06, Markus Schiltknecht <markus@bluegap.ch> wrote:
> I've only added the fields in include/catalog/pg_database.h. Do I need
> to fiddle other places?

Make sure you updated Natts_pg_database, the bootstrap DATA line, and
the stuff in src/backend/commands/dbcommands.c.

Other than that I don't know what's totally related to pg_database
itself as I haven't changed it in a long time.


--
Jonah H. Harris, Database Internals Architect
EnterpriseDB Corporation
732.331.1324


Re: adding fields to pg_database

From
Markus Schiltknecht
Date:
On Tue, 2006-04-11 at 14:07 -0400, Jonah H. Harris wrote:
> Make sure you updated Natts_pg_database, the bootstrap DATA line, and
> the stuff in src/backend/commands/dbcommands.c.

dbcommands.c was the missing peace, thank you!

Markus




Re: adding fields to pg_database

From
"Jonah H. Harris"
Date:
On 4/11/06, Markus Schiltknecht <markus@bluegap.ch> wrote:
> dbcommands.c was the missing peace, thank you!

No problemo :)

--
Jonah H. Harris, Database Internals Architect
EnterpriseDB Corporation
732.331.1324


Re: adding fields to pg_database

From
Tom Lane
Date:
"Jonah H. Harris" <jonah.harris@gmail.com> writes:
> On 4/11/06, Markus Schiltknecht <markus@bluegap.ch> wrote:
>> I've only added the fields in include/catalog/pg_database.h. Do I need
>> to fiddle other places?

> Make sure you updated Natts_pg_database, the bootstrap DATA line, and
> the stuff in src/backend/commands/dbcommands.c.

Good ways to answer this sort of question are:

1. Grep for references to some of the existing fields in the same catalog.

2. Look at the CVS diff for previous commits that added fields to the
same catalog.
        regards, tom lane


Re: adding fields to pg_database

From
"Jonah H. Harris"
Date:
On 4/11/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Good ways to answer this sort of question are:
>
> 1. Grep for references to some of the existing fields in the same catalog.
>
> 2. Look at the CVS diff for previous commits that added fields to the
> same catalog.

True, true.

--
Jonah H. Harris, Database Internals Architect
EnterpriseDB Corporation
732.331.1324