bety
bety copied to clipboard
variables: make name a key
- [ ] 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.
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