1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Add proallargtypes and proargmodes columns to pg_proc, as per my earlier

proposal for OUT parameter support.  The columns don't actually *do*
anything yet, they are just left NULLs.  But I thought I'd commit this
part separately as a fairly pure example of the tasks needed when adding
a column to pg_proc or one of the other core system tables.
This commit is contained in:
Tom Lane
2005-03-29 19:44:23 +00:00
parent eb47ee4865
commit 0f085f6e9d
8 changed files with 1767 additions and 1709 deletions

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.200 2005/03/29 00:16:54 tgl Exp $
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.201 2005/03/29 19:44:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -147,6 +147,10 @@ static const struct typinfo TypInfo[] = {
F_ARRAY_IN, F_ARRAY_OUT},
{"_text", 1009, TEXTOID, -1, false, 'i', 'x',
F_ARRAY_IN, F_ARRAY_OUT},
{"_oid", 1028, OIDOID, -1, false, 'i', 'x',
F_ARRAY_IN, F_ARRAY_OUT},
{"_char", 1002, CHAROID, -1, false, 'i', 'x',
F_ARRAY_IN, F_ARRAY_OUT},
{"_aclitem", 1034, ACLITEMOID, -1, false, 'i', 'x',
F_ARRAY_IN, F_ARRAY_OUT}
};

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.124 2005/03/29 00:16:56 tgl Exp $
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.125 2005/03/29 19:44:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -151,32 +151,36 @@ ProcedureCreate(const char *procedureName,
for (i = 0; i < Natts_pg_proc; ++i)
{
nulls[i] = ' ';
values[i] = (Datum) NULL;
values[i] = (Datum) 0;
replaces[i] = 'r';
}
i = 0;
namestrcpy(&procname, procedureName);
values[i++] = NameGetDatum(&procname); /* proname */
values[i++] = ObjectIdGetDatum(procNamespace); /* pronamespace */
values[i++] = Int32GetDatum(GetUserId()); /* proowner */
values[i++] = ObjectIdGetDatum(languageObjectId); /* prolang */
values[i++] = BoolGetDatum(isAgg); /* proisagg */
values[i++] = BoolGetDatum(security_definer); /* prosecdef */
values[i++] = BoolGetDatum(isStrict); /* proisstrict */
values[i++] = BoolGetDatum(returnsSet); /* proretset */
values[i++] = CharGetDatum(volatility); /* provolatile */
values[i++] = UInt16GetDatum(parameterCount); /* pronargs */
values[i++] = ObjectIdGetDatum(returnType); /* prorettype */
values[i++] = PointerGetDatum(proargtypes); /* proargtypes */
values[i++] = namesarray; /* proargnames */
if (namesarray == PointerGetDatum(NULL))
values[Anum_pg_proc_proname - 1] = NameGetDatum(&procname);
values[Anum_pg_proc_pronamespace - 1] = ObjectIdGetDatum(procNamespace);
values[Anum_pg_proc_proowner - 1] = Int32GetDatum(GetUserId());
values[Anum_pg_proc_prolang - 1] = ObjectIdGetDatum(languageObjectId);
values[Anum_pg_proc_proisagg - 1] = BoolGetDatum(isAgg);
values[Anum_pg_proc_prosecdef - 1] = BoolGetDatum(security_definer);
values[Anum_pg_proc_proisstrict - 1] = BoolGetDatum(isStrict);
values[Anum_pg_proc_proretset - 1] = BoolGetDatum(returnsSet);
values[Anum_pg_proc_provolatile - 1] = CharGetDatum(volatility);
values[Anum_pg_proc_pronargs - 1] = UInt16GetDatum(parameterCount);
values[Anum_pg_proc_prorettype - 1] = ObjectIdGetDatum(returnType);
values[Anum_pg_proc_proargtypes - 1] = PointerGetDatum(proargtypes);
/* XXX for now, just null out the new columns */
nulls[Anum_pg_proc_proallargtypes - 1] = 'n';
nulls[Anum_pg_proc_proargmodes - 1] = 'n';
if (namesarray != PointerGetDatum(NULL))
values[Anum_pg_proc_proargnames - 1] = namesarray;
else
nulls[Anum_pg_proc_proargnames - 1] = 'n';
values[i++] = DirectFunctionCall1(textin, /* prosrc */
values[Anum_pg_proc_prosrc - 1] = DirectFunctionCall1(textin,
CStringGetDatum(prosrc));
values[i++] = DirectFunctionCall1(textin, /* probin */
values[Anum_pg_proc_probin - 1] = DirectFunctionCall1(textin,
CStringGetDatum(probin));
/* proacl will be handled below */
/* start out with empty permissions */
nulls[Anum_pg_proc_proacl - 1] = 'n';
rel = heap_openr(ProcedureRelationName, RowExclusiveLock);
tupDesc = RelationGetDescr(rel);
@@ -242,10 +246,6 @@ ProcedureCreate(const char *procedureName,
else
{
/* Creating a new procedure */
/* start out with empty permissions */
nulls[Anum_pg_proc_proacl - 1] = 'n';
tup = heap_formtuple(tupDesc, values, nulls);
simple_heap_insert(rel, tup);
is_update = false;