From 086cf1458c6000a01e6c9ff44cc5da30cd65d145 Mon Sep 17 00:00:00 2001
From: Michael Meskes <meskes@postgresql.org>
Date: Thu, 29 Nov 2012 17:12:00 +0100
Subject: [PATCH] When processing nested structure pointer variables ecpg
 always expected an array datatype which of course is wrong.

Applied patch by Muhammad Usama <m.usama@gmail.com> to fix this.
---
 src/interfaces/ecpg/preproc/variable.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index e08e14ac18c..6ff574bbd92 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -100,7 +100,11 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in
 						}
 						break;
 					case '-':
-						return (find_struct_member(name, end, members->type->u.element->u.members, brace_level));
+						if (members->type->type == ECPGt_array)
+							return (find_struct_member(name, ++end, members->type->u.element->u.members, brace_level));
+						else
+							return (find_struct_member(name, ++end, members->type->u.members, brace_level));
+						break;
 						break;
 					case '.':
 						if (members->type->type == ECPGt_array)
-- 
GitLab