Project

General

Profile

« Previous | Next » 

Revision 7306

handle null givenNames from the LDAP dump.

View differences:

src/doi_registration.sql
419 419
set resourceMapLocation = 'https://cn.dataone.org/cn/v1/resolve/' || resourceMapId
420 420
where resourceMapId is not null;
421 421

  
422
-- fix null values (should not have to have this now, but it will not hurt)
423
update doi_registration doi
424
set creator = user_owner
425
from identifier id, xml_documents docs
426
where doi.guid = id.guid
427
and id.docid = docs.docid
428
and id.rev= docs.rev
429
and creator is null;
430

  
431
update doi_registration doi
432
set publisher = user_owner
433
from identifier id, xml_documents docs
434
where doi.guid = id.guid
435
and id.docid = docs.docid
436
and id.rev= docs.rev
437
and publisher is null;
438

  
439
update doi_registration doi
440
set creator = user_owner
441
from identifier id, xml_revisions docs
442
where doi.guid = id.guid
443
and id.docid = docs.docid
444
and id.rev= docs.rev
445
and creator is null;
446

  
447
update doi_registration doi
448
set publisher = user_owner
449
from identifier id, xml_revisions docs
450
where doi.guid = id.guid
451
and id.docid = docs.docid
452
and id.rev= docs.rev
453
and publisher is null;
454

  
422 455
--update creator usinig LDAP lookup
423 456
CREATE TABLE ecoinfo_dn (dn text, givenName text, sn text);
424 457
COPY ecoinfo_dn FROM '/tmp/ecoinfo_dn.csv' WITH CSV HEADER;
425 458

  
426 459
update doi_registration
427
set creator = givenName|| ' ' || sn
460
set creator = 
461
case when givenName is null then
462
	sn
463
else 
464
	givenName|| ' ' || sn
465
end
428 466
from ecoinfo_dn
429 467
where creator = dn;
430 468

  
431 469
update doi_registration
432
set publisher = givenName|| ' ' || sn
470
set publisher = 
471
case when givenName is null then
472
	sn
473
else 
474
	givenName|| ' ' || sn
475
end
433 476
from ecoinfo_dn
434 477
where publisher = dn;
435 478

  

Also available in: Unified diff