bety icon indicating copy to clipboard operation
bety copied to clipboard

variables: make name a key

Open gsrohde opened this issue 11 years ago • 1 comments

  • [ ] Consolidate duplicates
  • [ ] Add constraints to make name a key
  • [x] Add whitespace-normalization constraint to name column

Uniqueness violations

SELECT ARRAY_AGG(id), name FROM variables GROUP BY name HAVING COUNT(*) > 1;

yields three groups of duplicate names comprising 7 rows.

name is never NULL.

Constraints to add

ALTER TABLE variables ALTER COLUMN name SET NOT NULL;
ALTER TABLE variables ADD CONSTRAINT unique_names UNIQUE (name);

This makes name a key. To make it stronger, name should be constrained to be whitespace-normalized.

gsrohde avatar Jan 30 '15 23:01 gsrohde

Here is the current list of duplicate variable names:

array_agg   name
{202,242}   c2n_stem
{403,402,401}   CO2_concentration
{52,613}    height
{599,501}   leaf_reflect_nir
{500,600}   leaf_reflect_vis
{503,597}   leaf_trans_nir
{502,596}   leaf_trans_vis

dlebauer avatar Jul 12 '16 18:07 dlebauer