Hi,

I was testing the compatibility of pg_receivexlog with the previous PostgreSQL 
versions and I've discovered that in 9.5 and 9.6, although being compatible 
with 9.3, it prints an ugly but harmless error message.

$ 9.5/bin/pg_receivexlog -D /tmp/testx -v -p 5493
*pg_receivexlog: could not identify system: got 1 rows and 3 fields, expected 1 
rows and 4 or more fields*
*column number 3 is out of range 0..2*
pg_receivexlog: starting log streaming at 0/4000000 (timeline 1)

After the error, the streaming starts and continue without issue, as it was 
printed by the code that checks if the connection is not database specific, and 
this check is not needed on 9.3.

I've attached a little patch that removes the errors when connected to 9.3.

Regards,
Marco

-- 
Marco Nenciarini - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
marco.nenciar...@2ndquadrant.it | www.2ndQuadrant.it
diff --git a/src/bin/pg_basebackup/streamutil.c 
b/src/bin/pg_basebackup/streamutil.c
index 2c963b6..273b2cf 100644
*** a/src/bin/pg_basebackup/streamutil.c
--- b/src/bin/pg_basebackup/streamutil.c
*************** RunIdentifySystem(PGconn *conn, char **s
*** 295,308 ****
        if (db_name != NULL)
        {
                if (PQnfields(res) < 4)
!                       fprintf(stderr,
!                                       _("%s: could not identify system: got 
%d rows and %d fields, expected %d rows and %d or more fields\n"),
!                                       progname, PQntuples(res), 
PQnfields(res), 1, 4);
! 
!               if (PQgetisnull(res, 0, 3))
!                       *db_name = NULL;
                else
!                       *db_name = pg_strdup(PQgetvalue(res, 0, 3));
        }
  
        PQclear(res);
--- 295,315 ----
        if (db_name != NULL)
        {
                if (PQnfields(res) < 4)
!               {
!                       if (PQserverVersion(conn) >= 90400)
!                               fprintf(stderr,
!                                               _("%s: could not identify 
system: got %d rows and %d fields, expected %d rows and %d or more fields\n"),
!                                               progname, PQntuples(res), 
PQnfields(res), 1, 4);
!                       else
!                               *db_name = NULL;
!               }
                else
!               {
!                       if (PQgetisnull(res, 0, 3))
!                               *db_name = NULL;
!                       else
!                               *db_name = pg_strdup(PQgetvalue(res, 0, 3));
!               }
        }
  
        PQclear(res);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to