Project

General

Profile

« Previous | Next » 

Revision 3738

schemas/vegbien.sql: 1_to_1 and *_unique_within unique indexes intended to operate only when sourceaccessioncode is NULL: Changed to use `sourceaccessioncode IS NULL` WHERE condition instead of COALESCE element, since the sourceaccessioncode is not actually needed for the uniquification (it is already globally unique within the datasource if it's not NULL; this just covers the case where it is NULL)

View differences:

schemas/vegbien.sql
4113 4113
-- Name: aggregateoccurrence_taxonoccurrence_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4114 4114
--
4115 4115

  
4116
CREATE UNIQUE INDEX aggregateoccurrence_taxonoccurrence_1_to_1 ON aggregateoccurrence USING btree (taxonoccurrence_id, (COALESCE(sourceaccessioncode, '\\N'::text)));
4116
CREATE UNIQUE INDEX aggregateoccurrence_taxonoccurrence_1_to_1 ON aggregateoccurrence USING btree (taxonoccurrence_id) WHERE (sourceaccessioncode IS NULL);
4117 4117

  
4118 4118

  
4119 4119
--
......
4197 4197
-- Name: locationevent_unique_within_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4198 4198
--
4199 4199

  
4200
CREATE UNIQUE INDEX locationevent_unique_within_location ON locationevent USING btree (location_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(obsstartdate, 'infinity'::timestamp with time zone))) WHERE (parent_id IS NULL);
4200
CREATE UNIQUE INDEX locationevent_unique_within_location ON locationevent USING btree (location_id, (COALESCE(obsstartdate, 'infinity'::timestamp with time zone))) WHERE ((parent_id IS NULL) AND (sourceaccessioncode IS NULL));
4201 4201

  
4202 4202

  
4203 4203
--
......
4386 4386
-- Name: stemobservation_plantobservation_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4387 4387
--
4388 4388

  
4389
CREATE UNIQUE INDEX stemobservation_plantobservation_1_to_1 ON stemobservation USING btree (plantobservation_id, (COALESCE(sourceaccessioncode, '\\N'::text)));
4389
CREATE UNIQUE INDEX stemobservation_plantobservation_1_to_1 ON stemobservation USING btree (plantobservation_id) WHERE (sourceaccessioncode IS NULL);
4390 4390

  
4391 4391

  
4392 4392
--
......
4421 4421
-- Name: taxonoccurrence_locationevent_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4422 4422
--
4423 4423

  
4424
CREATE UNIQUE INDEX taxonoccurrence_locationevent_1_to_1 ON taxonoccurrence USING btree (locationevent_id, (COALESCE(sourceaccessioncode, '\\N'::text)));
4424
CREATE UNIQUE INDEX taxonoccurrence_locationevent_1_to_1 ON taxonoccurrence USING btree (locationevent_id) WHERE (sourceaccessioncode IS NULL);
4425 4425

  
4426 4426

  
4427 4427
--

Also available in: Unified diff