#!/bin/bash
# G.Landais : (for VESPA compatibility) update table  with ' ' to ''

tablename=`asu -source=METAtab name=B/planets/epn_core -out=dbname 2>/dev/null |grep '^[a-z]'|grep -v dbname`
echo "update table with empty values $tablename"

psql -Ucds vizier <<EOF
set search_path=viz7;
update $tablename set thumbnail_url='' where thumbnail_url=' ';
update $tablename set granule_uid='' where granule_uid=' ';
update $tablename set granule_gid='' where granule_gid=' ';
update $tablename set obs_id='' where obs_id=' ';
update $tablename set dataproduct_type='' where dataproduct_type=' ';
update $tablename set target_name='' where target_name=' ';
update $tablename set target_class='' where target_class=' ';
update $tablename set instrument_host_name='' where instrument_host_name=' ';
update $tablename set instrument_name='' where instrument_name=' ';
update $tablename set measurement_type='' where measurement_type=' ';
update $tablename set creation_date='' where creation_date=' ';
update $tablename set modification_date='' where modification_date=' ';
update $tablename set release_date='' where release_date=' ';
update $tablename set service_title='' where service_title=' ';
update $tablename set access_url='' where access_url=' ';
update $tablename set access_format='' where access_format=' ';
update $tablename set access_md5='' where access_md5=' ';
update $tablename set thumbnail_url='' where thumbnail_url=' ';
update $tablename set file_name='' where file_name=' ';
update $tablename set species='' where species=' ';
update $tablename set filter_1='' where filter_1=' ';
update $tablename set target_region='' where target_region=' ';
update $tablename set feature_name='' where feature_name=' ';
update $tablename set bib_reference='' where bib_reference=' ';
update $tablename set external_link='' where external_link=' ';
update $tablename set publisher='' where publisher=' ';
update $tablename set spatial_coordinate_description='' where spatial_coordinate_description=' ';
update $tablename set time_scale='' where time_scale=' ';
update $tablename set description='' where description=' ';

EOF

