Re: building pg_dump doesn't work

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: building pg_dump doesn't work
Date: 2009-03-04 15:06:55
Message-ID: 49AE990F.1010104@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Alvaro Herrera wrote:
>
>> Hmm, I had thought that pg_dump only wanted the header file, not the
>> keywords.o object file. I now see that I was wrong. I agree that your
>> proposed solution is a lot better. I'll see about it.
>
> Here it is. The #ifdef parts seem a bit ugly, but I'm not sure how can
> this be improved, given that ECPG is already using this file.

Perhaps this could be made less ugly by only having the ScanKeywords
array in the .c file, and #including that into other .c files in
src/backend/parser, ecpg and pg_dump.

So, keywords.c would look like:

#include "parser/keywords.h"
const ScanKeyword ScanKeywords[] = {
/* name, value, category */
PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD),
PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD),
PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD),
...

And there would be a new file in src/bin/pg_dump, say dumpkeywords.c,
that looks like this:

#include "c.h"

#define PG_KEYWORD(a,b,c) {a,b,c}
#include "src/backend/parser/keywords.c"

Not sure what to do about ScanKeywordLookup function.

> /*
> + * We don't want to include the gram.h file on frontend builds, except ECPG, so
> + * leave out the second struct member in that case.
> + */
> + #if !defined FRONTEND || defined ECPG_COMPILE
> + #define PG_KEYWORD(a,b,c) {a,b,c}
> + #else
> + #define PG_KEYWORD(a,b,c) {a,c}
> + #endif

Doesn't that put 'c' into the wrong field in ScanKeyword struct? It only
compiles because both 'value' and 'category' are int16.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-03-04 15:11:25 Re: building pg_dump doesn't work
Previous Message Alvaro Herrera 2009-03-04 14:46:31 Re: building pg_dump doesn't work