adding fields to pg_database

Started by Markus Schiltknechtalmost 20 years ago6 messages
#1Markus Schiltknecht
markus@bluegap.ch

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

#2Jonah H. Harris
jonah.harris@gmail.com
In reply to: Markus Schiltknecht (#1)
Re: adding fields to pg_database

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

#3Markus Schiltknecht
markus@bluegap.ch
In reply to: Jonah H. Harris (#2)
Re: adding fields to pg_database

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

#4Jonah H. Harris
jonah.harris@gmail.com
In reply to: Markus Schiltknecht (#3)
Re: adding fields to pg_database

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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jonah H. Harris (#2)
Re: adding fields to pg_database

"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

#6Jonah H. Harris
jonah.harris@gmail.com
In reply to: Tom Lane (#5)
Re: adding fields to pg_database

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