SELECT
	ds.id                        AS "id",
	ds.officialname              AS "officialname",
	ds.englishname               AS "englishname",
	ds.websiteurl                AS "websiteurl",
	ds.logourl                   AS "logourl",
	ds.contactemail              AS "contactemail",
	ds.latitude                  AS "latitude",
	ds.longitude                 AS "longitude",
	ds.timezone                  AS "timezone",
	ds.namespaceprefix           AS "namespaceprefix",
	ds.languages                 AS "languages",
	ds.collectedfrom             AS "collectedfrom",
	ds.dateofvalidation          AS "dateofvalidation",
	ds.provenanceaction          AS "provenanceaction",
	ds.dateofcollection          AS "dateofcollection",
	ds.platform                  AS "platform",
	ds.activationid              AS "activationId",
	ds.description               AS "description",
	ds.releasestartdate          AS "releasestartdate",
	ds.releaseenddate            AS "releaseenddate",
	ds.missionstatementurl       AS "missionstatementurl",
	ds.databaseaccesstype        AS "databaseaccesstype",
	ds.datauploadtype            AS "datauploadtype",
	ds.databaseaccessrestriction AS "databaseaccessrestriction",
	ds.datauploadrestriction     AS "datauploadrestriction",
	ds.citationguidelineurl      AS "citationguidelineurl",
	ds.certificates              AS "certificates",
	ds.aggregator                AS "aggregator",
	ds.issn                      AS "issn",
	ds.eissn                     AS "eissn",
	ds.lissn                     AS "lissn",
	ds.registeredby              AS "registeredby",
	ds.subjects                  AS "subjects",
	ds.managed                   AS "managed",
	ds.consenttermsofuse         AS "consenttermsofuse",
	ds.consenttermsofusedate     AS "consenttermsofusedate",
	ds.fulltextdownload          AS "fulltextdownload",
	ds.eosc_datasource_type      AS "eosc_datasource_type",
	ds.status                    AS "status",
	ds.primary_provide_gateway   AS primary_provide_gateway,
	array_to_string(ds.affiliated_provide_gateways, ',') AS affiliated_provide_gateways
FROM
	dsm_services ds
WHERE
	ds.id = :dsId 
	AND eosc_datasource_type IS NOT NULL
	AND dedup_main_service = true

	