xlog functions for pg_basebackup - Mailing list pgsql-hackers

From Magnus Hagander
Subject xlog functions for pg_basebackup
Date
Msg-id AANLkTikYk1DwuMP348+N4T6ebj+za5S2b0gFPLPKFkjn@mail.gmail.com
Whole thread Raw
List pgsql-hackers
In cleaning up the streaming part of pg_basebackup, I came across this
gem I copied from elsewherE:

/** We have to use postgres.h not postgres_fe.h here, because there's so much* backend-only stuff in the XLOG include
fileswe need.  But we need a* frontend-ish environment otherwise.  Hence this ugly hack.*/ 
#define FRONTEND 1
#include "postgres.h"


That's obviously quite ugly. I'm getting most defines out of
xlogdefs.h, which loads fine without that hack, but I'm also using the
XLogFileName() macro, which is in xlog_internal.h. The way I see it,
my options are:

1) keep doing wha tI do and include xlog_internal.h which defines it
2) redefine the macro locally (or just duplicate the code - it's only
one line after all, but it's more a matter of principle)
3) move the definition of the macro to some place that can be accessed
externally

thoughts?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Add support for logging the current role
Next
From: Robert Haas
Date:
Subject: Re: Add support for logging the current role