Re: how to add a new column in pg_proc table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: noman naeem <doublevision_17(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: how to add a new column in pg_proc table
Date: 2005-01-25 16:39:35
Message-ID: 4218.1106671175@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

noman naeem <doublevision_17(at)yahoo(dot)com> writes:
> I keep on getting errors.It be very helpful if some
> one can guide me regarding the basic steps for adding
> a column in the pg_proc table...

The odds are that you didn't correctly update either pg_proc.h itself,
the preset pg_attribute rows for it in pg_attribute.h (both versions!),
or you just forgot to adjust the number-of-attributes for pg_proc in
pg_class.h.

In pg_proc.h, remember that you have to fix the struct declaration,
the #defines for attribute numbers, plus adjust all the built-in entries
(that last is a *real* PITA...)

Not to mention adjust code that uses or updates pg_proc, particularly
catalog/pg_proc.c.

One other nonobvious gotcha is that varlength fields must be physically
positioned after all fixed-width fields, because the C code tends to
assume that it can get at fixed-width fields by struct overlay.

I'd suggest looking at the last patch that added a field to pg_proc for
guidelines and to make sure you did not miss anything:

2004-01-06 18:55 tgl

* doc/src/sgml/catalogs.sgml, src/backend/bootstrap/bootstrap.c,
src/backend/catalog/pg_aggregate.c, src/backend/catalog/pg_proc.c,
src/backend/commands/functioncmds.c, src/backend/nodes/copyfuncs.c,
src/backend/nodes/equalfuncs.c, src/backend/parser/gram.y,
src/backend/utils/adt/sets.c, src/backend/utils/fmgr/fmgr.c,
src/include/catalog/catversion.h,
src/include/catalog/pg_attribute.h, src/include/catalog/pg_class.h,
src/include/catalog/pg_proc.h, src/include/nodes/nodes.h,
src/include/nodes/parsenodes.h, src/pl/plperl/plperl.c,
src/pl/plpgsql/src/pl_comp.c, src/pl/plpython/plpython.c,
src/pl/tcl/pltcl.c: Apply the core parts of Dennis Bjorklund's
patch to allow function parameters to be declared with names.
pg_proc has a column to store names, and CREATE FUNCTION can insert
data into it, but that's all as yet. I need to do more work on the
pg_dump and plpgsql portions of the patch before committing those,
but I thought I'd get the bulky changes in before the tree drifts
under me. initdb forced due to pg_proc change.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2005-01-25 16:54:26 Re: how to set password while loging into database
Previous Message Bruno Wolff III 2005-01-25 16:25:47 Re: [PATCHES] Merge pg_shadow && pg_group -- UNTESTED