Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit45e98ee

Browse files
committed
Remove obsolete prohibition on function name matching a column name.
ProcedureCreate formerly threw an error if the function to be createdhas one argument of composite type and the function name matches somecolumn of the composite type. This was a (very non-bulletproof) defenseagainst creating situations where f(x) and x.f are ambiguous. But wedon't really need such a defense in the wake of commitb97a346, whichallows us to deal with such situations fairly cleanly. This behavioralso created a dump-and-reload hazard, since a function might berejected if a conflicting column name had been added to the inputcomposite type later. Hence, let's just drop the check.Discussion:https://postgr.es/m/CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com
1 parentb97a346 commit45e98ee

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

‎src/backend/catalog/pg_proc.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ ProcedureCreate(const char *procedureName,
108108
boolnulls[Natts_pg_proc];
109109
Datumvalues[Natts_pg_proc];
110110
boolreplaces[Natts_pg_proc];
111-
Oidrelid;
112111
NameDataprocname;
113112
TupleDesctupDesc;
114113
boolis_update;
@@ -254,20 +253,6 @@ ProcedureCreate(const char *procedureName,
254253
errmsg("unsafe use of pseudo-type \"internal\""),
255254
errdetail("A function returning \"internal\" must have at least one \"internal\" argument.")));
256255

257-
/*
258-
* don't allow functions of complex types that have the same name as
259-
* existing attributes of the type
260-
*/
261-
if (parameterCount==1&&
262-
OidIsValid(parameterTypes->values[0])&&
263-
(relid=typeOrDomainTypeRelid(parameterTypes->values[0]))!=InvalidOid&&
264-
get_attnum(relid,procedureName)!=InvalidAttrNumber)
265-
ereport(ERROR,
266-
(errcode(ERRCODE_DUPLICATE_COLUMN),
267-
errmsg("\"%s\" is already an attribute of type %s",
268-
procedureName,
269-
format_type_be(parameterTypes->values[0]))));
270-
271256
if (paramModes!=NULL)
272257
{
273258
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp