From 09ee79c485dab82e5f9fc67a85d1ae4a0139d421 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Tue, 26 Sep 2017 14:45:11 +0200
Subject: [PATCH] [TAP] Fix the loading of columns when the column coosys_id
 exists.

---
 src/tap/db/JDBCConnection.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/tap/db/JDBCConnection.java b/src/tap/db/JDBCConnection.java
index cf8450d..7bb175f 100644
--- a/src/tap/db/JDBCConnection.java
+++ b/src/tap/db/JDBCConnection.java
@@ -201,6 +201,11 @@ public class JDBCConnection implements DBConnection {
 	/** Name of the database column giving the database name of a TAP column, table or schema. */
 	protected final static String DB_NAME_COLUMN = "dbname";
 
+	/** Name of the database column giving the coordinate system ID associated
+	 * with a TAP column.
+	 * @since 2.1 */
+	protected final static String COOSYS_ID_COLUMN = "dbname";
+
 	/** Connection ID (typically, the job ID). It lets identify the DB errors linked to the Job execution in the logs. */
 	protected final String ID;
 
@@ -1302,8 +1307,10 @@ public class JDBCConnection implements DBConnection {
 				sqlBuf.append(", ");
 				translator.appendIdentifier(sqlBuf, DB_NAME_COLUMN, IdentifierField.COLUMN);
 			}
-			if (hasCoosys)
-				sqlBuf.append(", ").append(translator.getColumnName(tableDef.getColumn("coosys_id")));
+			if (hasCoosys){
+				sqlBuf.append(", ");
+				translator.appendIdentifier(sqlBuf, COOSYS_ID_COLUMN, IdentifierField.COLUMN);
+			}
 			sqlBuf.append(" FROM ").append(translator.getTableName(tableDef, supportsSchema));
 			if (hasColumnIndex)
 				sqlBuf.append(" ORDER BY 1,12,2");
-- 
GitLab