ecpg - GRANT bug

From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: pgsql-bugs(at)postgresql(dot)org
Cc: lkindness(at)csl(dot)co(dot)uk, maves(at)csl(dot)co(dot)uk, Michael Meskes <meskes(at)postgresql(dot)org>
Subject: ecpg - GRANT bug
Date: 2001-10-12 15:33:00
Message-ID: 15303.3372.751660.717784@elsick.csl.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I've noticed general buggyness with ecpg on one of my source files for
a while now but it only got really annoying after setting up overnight
build on Linux (output corrupt code), Solaris (output correct code),
AIX (crashed) and HPUX (crashed).

After comparing the output from ecpg on Linux and Solaris the
following type of statement was the root of the crash:

EXEC SQL GRANT ALL ON exampletable TO PUBLIC;

When the parser code was rebuilding the query to pass onto the server
it was trying to include an extra, non-existent, parameter...

The bug is present in 7.1.2, 7.1.3 and the current CVS sources. The
following patch (against CVS version) corrects this bug:

./interfaces/ecpg/preproc/preproc.y
*** ./interfaces/ecpg/preproc/preproc.y.orig Fri Oct 12 16:22:05 2001
--- ./interfaces/ecpg/preproc/preproc.y Fri Oct 12 16:22:09 2001
***************
*** 1693,1699 ****

GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee_list opt_with_grant
{
! $$ = cat_str(8, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7);
}
;

--- 1693,1699 ----

GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee_list opt_with_grant
{
! $$ = cat_str(7, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7);
}
;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-10-12 17:18:49 Re: ecpg - GRANT bug
Previous Message Bruce Momjian 2001-10-12 14:44:03 Re: [tim@perdue.net: Re: mysql2pgsql tool]

Browse pgsql-hackers by date

  From Date Subject
Next Message None 2001-10-12 15:56:56 java
Previous Message Oleg Bartunov 2001-10-12 15:02:50 New contrib/tsearch module for 7.2