From 5de4ca01ba40f959ad20b1000e482889e9d0704c Mon Sep 17 00:00:00 2001
From: David Hoese <david.hoese@ssec.wisc.edu>
Date: Tue, 22 Dec 2020 12:55:06 -0600
Subject: [PATCH] Fix layer times for postgres using the wrong column name

---
 mapserver/cgi-bin/layer_times_postgres.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mapserver/cgi-bin/layer_times_postgres.py b/mapserver/cgi-bin/layer_times_postgres.py
index 0b61b73..0eb6d30 100755
--- a/mapserver/cgi-bin/layer_times_postgres.py
+++ b/mapserver/cgi-bin/layer_times_postgres.py
@@ -33,7 +33,7 @@ try:
     conn = psycopg2.connect(connect_str)
     with conn:
         with conn.cursor() as cur:
-            cur.execute(sql.SQL("SELECT time FROM {}").format(sql.Identifier(table_name)))
+            cur.execute(sql.SQL("SELECT start_time FROM {}").format(sql.Identifier(table_name)))
             times = cur.fetchall()
 except psycopg2.errors.DataBaseError:
     print("""Status: 500 Database Error
@@ -44,6 +44,8 @@ Error requesting time information from database.
 """)
     sys.exit(1)
 
+# postgres returned a list of tuples
+times = [time_tuple[0] for time_tuple in times]
 
 print("Content-Type: application/json")
 print("Access-Control-Allow-Origin: *")
-- 
GitLab