[GitHub] madlib pull request #339: Build: Add PG11 Support

2018-11-28 Thread kaknikhil
Github user kaknikhil commented on a diff in the pull request:

https://github.com/apache/madlib/pull/339#discussion_r237327903
  
--- Diff: src/ports/postgres/modules/kmeans/kmeans.sql_in ---
@@ -766,15 +766,30 @@ BEGIN
 
 proc_fn_dist := fn_dist
 || '(DOUBLE PRECISION[], DOUBLE PRECISION[])';
-IF (SELECT prorettype != 'DOUBLE PRECISION'::regtype OR proisagg = TRUE
-FROM pg_proc WHERE oid = proc_fn_dist) THEN
-RAISE EXCEPTION 'Kmeans error: Distance function has wrong 
signature or is not a simple function.';
-END IF;
-proc_agg_centroid := agg_centroid || '(DOUBLE PRECISION[])';
-IF (SELECT prorettype != 'DOUBLE PRECISION[]'::regtype OR proisagg = 
FALSE
-FROM pg_proc WHERE oid = proc_agg_centroid) THEN
-RAISE EXCEPTION 'Kmeans error: Mean aggregate has wrong signature 
or is not an aggregate.';
+
+-- Handle PG11 pg_proc table changes
--- End diff --

We can write a sql function called `is_valid_distance_function()` that can 
be called from either python or sql. This function will abstract out the pg11 
changes and we would just call this function from kmeans.sql_in and knn.py_in.


---


[GitHub] madlib pull request #339: Build: Add PG11 Support

2018-11-28 Thread kaknikhil
Github user kaknikhil commented on a diff in the pull request:

https://github.com/apache/madlib/pull/339#discussion_r237326034
  
--- Diff: src/ports/postgres/modules/utilities/utilities.py_in ---
@@ -407,6 +407,15 @@ def set_client_min_messages(new_level):
 return old_msg_level
 # -
 
+def is_less_than_pg11(schema_madlib, **kwargs):
--- End diff --

I noticed that we have another function called `is_less_than_pg90` which 
has the same code as this function. We probably don't need the pg90 function 
anymore but it would be nice if the `is_less_than_pg11`  function can be 
generalized to take in a major postgres version and then compare the current 
version with the passed major version.


---