Skip to content

Commit

Permalink
Bug #250 - set GUC for application name in log shipper daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Browne committed Nov 15, 2011
1 parent a39d4ad commit 9007a35
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RELEASE
@@ -1,6 +1,9 @@
#+OPTIONS: ^:{}
* Slony-I Release Notes

** 2.2.0
- Bug #250 :: Log shipper does not report application name - add in setting of GUC

** 2.1.1

- Bug #246 :: Include path order changes
Expand Down
21 changes: 21 additions & 0 deletions src/slony_logshipper/slony_logshipper.c
Expand Up @@ -1202,6 +1202,7 @@ static int
get_current_at_counter(void)
{
SlonDString ds;
SlonDString query;
PGresult *res;
char *s;

Expand Down Expand Up @@ -1229,6 +1230,26 @@ get_current_at_counter(void)
PQsetNoticeProcessor(dbconn, notice_processor, NULL);
}

dstring_init(&query);
slon_mkquery(&query,"select 1 from pg_catalog.pg_settings where name= 'application_name'; ");
res = PQexec (dbconn, dstring_data(&query));

if (PQresultStatus(res) != PGRES_TUPLES_OK)
return -1;
dstring_free(&query);

if (PQntuples(res) == 0)
{
PQclear(res);
} else {
PQclear(res);
dstring_init(&query);
slon_mkquery(&query,"SET application_name TO 'slony_logshipper'; ");
res=PQexec(dbconn, dstring_data(&query));
dstring_free(&query);
PQclear(res);
}

dstring_init(&ds);
slon_mkquery(&ds, "select at_counter from %s.sl_archive_tracking;",
namespace);
Expand Down

0 comments on commit 9007a35

Please sign in to comment.