text: CREATE TABLE metrics (recordid int NOT NULL, name varchar(32) NOT NULL, numericvalue double, textvalue varchar(32), PRIMARY KEY (recordid, name), CONSTRAINT not_null_metric_value CHECK (numericvalue IS NOT NULL OR textvalue IS NOT NULL));
  CREATE TABLE records (id int GENERATED BY DEFAULT AS IDENTITY, time timestamp NOT NULL, metrictype varchar(32), hostname varchar_ignorecase(32) NOT NULL, PRIMARY KEY (id));
  -- disabled due to fast generating agents that may break this constraint (timestamp has insufficient precision)
  -- CREATE UNIQUE INDEX unique_records ON records (time, metrictype, hostname);
  ALTER TABLE metrics ADD CONSTRAINT record_has_recorded_metrics FOREIGN KEY (recordid) REFERENCES records (id) ON UPDATE Cascade ON DELETE Cascade;
  CREATE ALIAS seconds DETERMINISTIC AS $$ long seconds(Timestamp timestamp) { return timestamp.getTime() / 1000; } $$;
  
  