aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2003-05-22 17:09:00 +0000
committerMichael Meskes <meskes@postgresql.org>2003-05-22 17:09:00 +0000
commitdbd55d3a5b281131873c25d67a25434554b61d1e (patch)
treeab969b2959520a3d7f3e610206a9705a0582ea52
parentc120f4ba0adaeff5f4311c2edccdb58235e3ac82 (diff)
downloadpostgresql-dbd55d3a5b281131873c25d67a25434554b61d1e.tar.gz
postgresql-dbd55d3a5b281131873c25d67a25434554b61d1e.zip
Fixed segfault when detecting undefined cursor.
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index bcdf775c9d4..bb00b7ed3da 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.220 2003/05/22 07:58:41 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.221 2003/05/22 17:09:00 meskes Exp $ */
/* Copyright comment */
%{
@@ -610,15 +610,17 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
snprintf(errortext, sizeof(errortext), "trying to open undeclared cursor %s\n", $1);
mmerror(PARSE_ERROR, ET_ERROR, errortext);
}
+ else
+ {
+ /* merge variables given in prepare statement with those given here */
+ for (p = ptr->argsinsert; p; p = p->next)
+ append_variable(&argsinsert, p->variable, p->var_array_element, p->indicator, p->ind_array_element);
- /* merge variables given in prepare statement with those given here */
- for (p = ptr->argsinsert; p; p = p->next)
- append_variable(&argsinsert, p->variable, p->var_array_element, p->indicator, p->ind_array_element);
-
- for (p = ptr->argsresult; p; p = p->next)
- add_variable(&argsresult, p->variable, p->var_array_element, p->indicator, p->ind_array_element);
+ for (p = ptr->argsresult; p; p = p->next)
+ add_variable(&argsresult, p->variable, p->var_array_element, p->indicator, p->ind_array_element);
- output_statement(mm_strdup(ptr->command), 0, ptr->connection ? mm_strdup(ptr->connection) : NULL);
+ output_statement(mm_strdup(ptr->command), 0, ptr->connection ? mm_strdup(ptr->connection) : NULL);
+ }
}
| ECPGPrepare
{