Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VkYHe-0008WM-9T for pgsql-bugs@arkaria.postgresql.org; Sun, 24 Nov 2013 11:55:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VkYHd-00017f-Ph for pgsql-bugs@arkaria.postgresql.org; Sun, 24 Nov 2013 11:55:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VkYHd-00017Z-3e for pgsql-bugs@postgresql.org; Sun, 24 Nov 2013 11:55:25 +0000 Received: from gauss.credativ.com ([93.94.130.89]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VkYHX-0004Tv-88 for pgsql-bugs@postgresql.org; Sun, 24 Nov 2013 11:55:24 +0000 Received: from feivel (p4FE08F25.dip0.t-ipconnect.de [79.224.143.37]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mme@gauss.credativ.com) by gauss.credativ.com (Postfix) with ESMTPSA id C90191B60AC; Sun, 24 Nov 2013 12:55:17 +0100 (CET) Received: by feivel (Postfix, from userid 1000) id 752FA9F12B; Sun, 24 Nov 2013 12:55:17 +0100 (CET) Date: Sun, 24 Nov 2013 12:55:17 +0100 From: Michael Meskes To: alexsav23@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8608: ECPG: sizeof() in EXEC SQL DECLARE SECTION Message-ID: <20131124115517.GA1658@feivel.credativ.lan> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --SUOF0GtieIMvvwua Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Nov 19, 2013 at 10:39:48PM +0000, alexsav23@gmail.com wrote: > d:\>"c:\Program Files\PostgreSQL\9.3\bin\ecpg.exe"-o 1.c 1.pgc > 1.pgc: 4: ERROR: syntax error at or near "(" > error deleting output file "1.c" And another patch to try. Please send me feedback. Michael -- Michael Meskes Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org Jabber: michael.meskes at gmail dot com VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL --SUOF0GtieIMvvwua Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ecpg.sizeof.diff" commit 08d1b22b3be2305ad6b83ca275829ff26305f5d7 Author: Michael Meskes Date: Sun Nov 24 12:51:21 2013 +0100 Allow C array definitions to use sizeof(). When parsing C variable definitions ecpg should allow sizeof() operators as array dimensions. diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 342b7bc..6ef9f1a 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -1865,6 +1865,11 @@ Iresult: Iconst { $$ = $1; } | Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); } | ecpg_sconst { $$ = $1; } | ColId { $$ = $1; } + | ColId '(' ColId ')' { if (pg_strcasecmp($1, "sizeof") != 0) + mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition"); + else + $$ = cat_str(4,$1, mm_strdup("("), $3, mm_strdup(")")); + } ; execute_rest: /* EMPTY */ { $$ = EMPTY; } --SUOF0GtieIMvvwua Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --SUOF0GtieIMvvwua--