PG_CONFIGURE=`$PG_CONFIG_LOCATION --configure`
pg_config_version=`$PG_CONFIG_LOCATION --version`
- PG_VERSION=`expr "$pg_config_version" : '[[^0-9]]*\([[0-9]]*\.[[0-9]]*\)'`
-
+ PG_VERSION=`expr "$pg_config_version" : '[[^0-9]]*\([[0-9\.]]*\)'`
AC_MSG_CHECKING(for correct version of PostgreSQL)
- PG_VERSION_MAJOR=`echo $PG_VERSION | cut -d. -f1`
+ PG_VERSION_MAJOR=`echo $PG_VERSION | sed -e 's|\([[0-9]]*\)\(\.*.*\)|\1|'`
PG_VERSION_MINOR=`echo $PG_VERSION | cut -d. -f2`
if test "$PG_VERSION_MAJOR" = "7"; then
AC_MSG_RESULT("error")
int major = 0;
int minor = 0;
int patch = 0;
+ int scanres=0;
dstring_init(&query);
slon_mkquery(&query, "SELECT version();");
PQclear(res);
return -1;
}
- if (sscanf(PQgetvalue(res, 0, 0), "PostgreSQL %d.%d.%d", &major, &minor, &patch) < 2 &&
- sscanf(PQgetvalue(res, 0, 0), "EnterpriseDB %d.%d.%d", &major, &minor, &patch) < 2)
+ scanres=sscanf(PQgetvalue(res, 0, 0), "PostgreSQL %d.%d.%d", &major, &minor, &patch);
+ if(scanres < 1)
+ {
+ scanres=sscanf(PQgetvalue(res, 0, 0), "EnterpriseDB %d.%d.%d", &major, &minor, &patch);
+ }
+ if ( scanres < 1)
{
PQclear(res);
return -1;
int minor = 0;
int patch = 0;
int version = 0;
-
+ int scanres=0;
+
if (db_begin_xact(stmt, adminfo, false) < 0)
return -1;
if (res == NULL)
return -1;
-
- if (sscanf(PQgetvalue(res, 0, 0), "PostgreSQL %d.%d.%d", &major, &minor, &patch) < 2 &&
- sscanf(PQgetvalue(res, 0, 0), "EnterpriseDB %d.%d.%d", &major, &minor, &patch) < 2)
+ scanres=sscanf(PQgetvalue(res, 0, 0), "PostgreSQL %d.%d.%d", &major, &minor, &patch);
+ if(scanres < 1)
+ {
+ scanres=sscanf(PQgetvalue(res, 0, 0), "EnterpriseDB %d.%d.%d", &major, &minor, &patch);
+ }
+ if ( scanres < 1)
{
fprintf(stderr, "%s:%d: failed to parse %s for DB version\n",
stmt->stmt_filename, stmt->stmt_lno,