Skip to content

Commit d66daab

Browse files
committed
Remove typeidIsValid() checks in can_coerce_type(). These checks
were pretty expensive and I believe the case they were put in to defend against can no longer arise, now that we have dependency checks to prevent deletion of a type entry that is still referenced. Certainly the example given in the CVS log entry can't happen anymore. Since this was the only use of typeidIsValid(), remove the routine too.
1 parent bbc0483 commit d66daab

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

src/backend/parser/parse_coerce.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.128 2005/05/05 00:19:47 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.129 2005/05/29 18:24:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -371,12 +371,6 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
371371
if (inputTypeId == targetTypeId)
372372
continue;
373373

374-
/* don't choke on references to no-longer-existing types */
375-
if (!typeidIsValid(inputTypeId))
376-
return false;
377-
if (!typeidIsValid(targetTypeId))
378-
return false;
379-
380374
/* accept if target is ANY */
381375
if (targetTypeId == ANYOID)
382376
continue;

src/backend/parser/parse_type.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.74 2005/04/28 21:47:14 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.75 2005/05/29 18:24:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -239,15 +239,6 @@ typenameType(const TypeName *typename)
239239
return (Type) tup;
240240
}
241241

242-
/* check to see if a type id is valid, returns true if it is */
243-
bool
244-
typeidIsValid(Oid id)
245-
{
246-
return SearchSysCacheExists(TYPEOID,
247-
ObjectIdGetDatum(id),
248-
0, 0, 0);
249-
}
250-
251242
/* return a Type structure, given a type id */
252243
/* NB: caller must ReleaseSysCache the type tuple when done with it */
253244
Type

src/include/parser/parse_type.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/parser/parse_type.h,v 1.29 2004/12/31 22:03:38 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/include/parser/parse_type.h,v 1.30 2005/05/29 18:24:14 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -25,7 +25,6 @@ extern char *TypeNameToString(const TypeName *typename);
2525
extern Oid typenameTypeId(const TypeName *typename);
2626
extern Type typenameType(const TypeName *typename);
2727

28-
extern bool typeidIsValid(Oid id);
2928
extern Type typeidType(Oid id);
3029

3130
extern Oid typeTypeId(Type tp);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy