summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2005-12-09 17:08:49 +0000
committerTom Lane2005-12-09 17:08:49 +0000
commit2e468aa5d79cd4a14ac2e733e635e947471afc01 (patch)
treee41129a7addc49fe227317fcaeb84228c68aae5e
parent07044f5d6fc49306caf5d721784efb3ebaa085a7 (diff)
Fix core dump in error path of plpgsql_parse_tripwordtype. Somebody
introduced a copy-and-pasteo while trying to simplify the code.
-rw-r--r--src/pl/plpgsql/src/pl_comp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index ebe5d691124..b89f975981c 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.96 2005/11/22 18:17:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.97 2005/12/09 17:08:49 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -1316,11 +1316,11 @@ plpgsql_parse_dblwordtype(char *word)
0, 0, 0);
if (!HeapTupleIsValid(classtup))
goto done;
+ classStruct = (Form_pg_class) GETSTRUCT(classtup);
/*
* It must be a relation, sequence, view, or type
*/
- classStruct = (Form_pg_class) GETSTRUCT(classtup);
if (classStruct->relkind != RELKIND_RELATION &&
classStruct->relkind != RELKIND_SEQUENCE &&
classStruct->relkind != RELKIND_VIEW &&
@@ -1328,13 +1328,13 @@ plpgsql_parse_dblwordtype(char *word)
goto done;
/*
- * Fetch the named table field and it's type
+ * Fetch the named table field and its type
*/
attrtup = SearchSysCacheAttName(classOid, cp[1]);
if (!HeapTupleIsValid(attrtup))
goto done;
-
attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
+
typetup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(attrStruct->atttypid),
0, 0, 0);
@@ -1373,10 +1373,10 @@ plpgsql_parse_tripwordtype(char *word)
{
Oid classOid;
HeapTuple classtup = NULL;
- Form_pg_class classStruct;
HeapTuple attrtup = NULL;
- Form_pg_attribute attrStruct;
HeapTuple typetup = NULL;
+ Form_pg_class classStruct;
+ Form_pg_attribute attrStruct;
char *cp[2];
char *colname[1];
int qualified_att_len;
@@ -1421,11 +1421,11 @@ plpgsql_parse_tripwordtype(char *word)
0, 0, 0);
if (!HeapTupleIsValid(classtup))
goto done;
+ classStruct = (Form_pg_class) GETSTRUCT(classtup);
/*
* It must be a relation, sequence, view, or type
*/
- classStruct = (Form_pg_class) GETSTRUCT(classtup);
if (classStruct->relkind != RELKIND_RELATION &&
classStruct->relkind != RELKIND_SEQUENCE &&
classStruct->relkind != RELKIND_VIEW &&
@@ -1433,14 +1433,14 @@ plpgsql_parse_tripwordtype(char *word)
goto done;
/*
- * Fetch the named table field and it's type
+ * Fetch the named table field and its type
*/
plpgsql_convert_ident(cp[1], colname, 1);
attrtup = SearchSysCacheAttName(classOid, colname[0]);
if (!HeapTupleIsValid(attrtup))
goto done;
-
attrStruct = (Form_pg_attribute) GETSTRUCT(attrtup);
+
typetup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(attrStruct->atttypid),
0, 0, 0);
@@ -1459,7 +1459,7 @@ plpgsql_parse_tripwordtype(char *word)
done:
if (HeapTupleIsValid(classtup))
ReleaseSysCache(classtup);
- if (HeapTupleIsValid(classtup))
+ if (HeapTupleIsValid(attrtup))
ReleaseSysCache(attrtup);
if (HeapTupleIsValid(typetup))
ReleaseSysCache(typetup);