The 'pubdate' attribute is necessary for sorting by publication date to
work correctly. It was not populated in the 2.0-2.1 upgrade script, so
populate it now based on the 'date1' attribute.
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Michael Peters <mrpeters@library.in.gov>
GROUP BY 1) x
WHERE x.record = metabib.record_attr.id;
-
-
+UPDATE metabib.record_attr
+ SET attrs = attrs || ('pubdate' => (attrs->'date1'))
+ WHERE defined(attrs, 'pubdate') IS FALSE
+ AND defined(attrs, 'date1') IS TRUE;
--- /dev/null
+-- Fix sorting by pubdate by ensuring migrated records
+-- have a pubdate attribute in metabib.record_attr.attrs
+UPDATE metabib.record_attr
+ SET attrs = attrs || ('pubdate' => (attrs->'date1'))
+ WHERE defined(attrs, 'pubdate') IS FALSE
+ AND defined(attrs, 'date1') IS TRUE;