]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix pgsql backend compilation on centos 6 3477/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 30 Oct 2015 08:28:30 +0000 (09:28 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Sun, 28 Feb 2016 12:09:16 +0000 (13:09 +0100)
modules/gpgsqlbackend/spgsql.cc

index 44e08da1de5f4cf6c06481c9134a87dc307489db..f8954e5f6c74575a8472fdd3d4e41041635b92c9 100644 (file)
@@ -96,10 +96,16 @@ public:
     // by stored procedures. you can return more than one
     // if you return SETOF refcursor.
     if (PQftype(d_res_set, 0) == 1790) { // REFCURSOR
+#if PG_VERSION_NUM > 90000
+      // PQescapeIdentifier was added to libpq in postggresql 9.0
       char *val = PQgetvalue(d_res_set, d_cur_set++, 0);
       char *portal =  PQescapeIdentifier(d_db(), val, strlen(val));
       string cmd = string("FETCH ALL FROM \"") + string(portal) + string("\"");
       PQfreemem(portal);
+#else
+      string portal = string(PQgetvalue(d_res_set, d_cur_set++, 0));
+      string cmd = string("FETCH ALL FROM \"") + portal + string("\"");
+#endif
       // execute FETCH
       if (d_dolog)
          L<<Logger::Warning<<"Query: "<<cmd<<endl;