Parcourir la source

fix bug where random sample was picking random references incorrectly

Daniel Sheffield il y a 1 an
Parent
commit
586cf55382
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      create-views.sql

+ 4 - 1
create-views.sql

@@ -65,7 +65,10 @@ DECLARE
   v_table_id int;
   v_table text;
 BEGIN
-SELECT tableid, tablename, reltuples INTO v_table_id, v_table, v_estimate FROM pg_categories JOIN pg_class ON tablename = relname;
+SELECT tableid, tablename, reltuples INTO v_table_id, v_table, v_estimate
+FROM pg_categories
+JOIN pg_class ON tablename = relname
+WHERE p_name = name;
 SELECT 1000::double precision / v_estimate INTO v_percentage;
 RETURN QUERY EXECUTE 'SELECT '|| v_table_id ||' AS ordinal,
   '''|| p_name ||''' AS category, translation, reference