Duplicate CDF: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
This query checks for Duplicate CDFs according to {{IMSMANG}} rules.
This query checks for Duplicate CDFs according to {{IMSMANG}} rules i.e. unique name (including spaces), data type per parent.
<pre>
<pre>
PostgreSQL
SELECT
SELECT
customdefinedfield.name,
"public".customdefinedfield."name",
customdefinedfield.cdf_datatype,
"public".customdefinedfield.cdf_datatype,
customdefinedfield.entitytype,
"public".customdefinedfield.entitytype,
Count(customdefinedfield.cdf_id)
Count("public".customdefinedfield.cdf_id)
FROM
FROM
customdefinedfield
"public".customdefinedfield
GROUP BY
GROUP BY
customdefinedfield.name,
"public".customdefinedfield."name",
customdefinedfield.cdf_datatype,
"public".customdefinedfield.cdf_datatype,
customdefinedfield.entitytype
"public".customdefinedfield.entitytype
HAVING
HAVING
Count(customdefinedfield.cdf_id) > '1'
Count("public".customdefinedfield.cdf_id) > 1
ORDER BY
ORDER BY
customdefinedfield.entitytype ASC,
1, 2
customdefinedfield.name ASC
</pre>
</pre>


This query checks for Duplicate CDFs based only on name and. If you get any duplicates here, you need to double-check that the Staging area database is created correctly.
{{Warning| Depending on data type, etc. there might '''not''' be any error messages during the Staging area generation.}}
This query checks for Duplicate CDFs based only on name in lower case and length 63. If you get any duplicates here, you need to double-check that the Staging area database is created correctly.  
<pre>
<pre>
PostgreSQL
SELECT
SELECT
customdefinedfield.name,
left(lower("public".customdefinedfield."name"), 63) AS max_length,
customdefinedfield.entitytype,
"public".customdefinedfield.entitytype,
Count(customdefinedfield.cdf_id)
Count("public".customdefinedfield.cdf_id)
FROM
FROM
customdefinedfield
"public".customdefinedfield
GROUP BY
GROUP BY
customdefinedfield.name,
max_length,
customdefinedfield.entitytype
"public".customdefinedfield.entitytype
HAVING
HAVING
Count(customdefinedfield.cdf_id) > '1'
Count("public".customdefinedfield.cdf_id) > 1
ORDER BY
ORDER BY
customdefinedfield.entitytype ASC,
1, 2
customdefinedfield.name ASC
</pre>
</pre>


 
{{Warning| Depending on data type, etc. there might '''not''' be any error messages during the Staging area geo generation.}}
This query checks for Duplicate CDFs based only on name in lower case and length 31. If you get any duplicates here, you need to double-check that the Staging area geo database is created correctly and the column names used in the geo views are not confusing.
<pre>
PostgreSQL
SELECT
left(lower("public".customdefinedfield."name"), 31) AS max_length,
"public".customdefinedfield.entitytype,
Count("public".customdefinedfield.cdf_id)
FROM
"public".customdefinedfield
GROUP BY
max_length,
"public".customdefinedfield.entitytype
HAVING
Count("public".customdefinedfield.cdf_id) > 1
ORDER BY
1, 2
</pre>
{{NavBox Upgrade}}
{{NavBox Upgrade}}
[[Category:NoPublic]]
[[Category:NoPublic]]
[[Category:SQL Queries]]
[[Category:SQL Queries]]

Revision as of 09:49, 3 July 2015

This query checks for Duplicate CDFs according to IMSMANG rules i.e. unique name (including spaces), data type per parent.

PostgreSQL
SELECT
"public".customdefinedfield."name",
"public".customdefinedfield.cdf_datatype,
"public".customdefinedfield.entitytype,
Count("public".customdefinedfield.cdf_id)
FROM
"public".customdefinedfield
GROUP BY
"public".customdefinedfield."name",
"public".customdefinedfield.cdf_datatype,
"public".customdefinedfield.entitytype
HAVING
Count("public".customdefinedfield.cdf_id) > 1
ORDER BY
1, 2
Depending on data type, etc. there might not be any error messages during the Staging area generation.

This query checks for Duplicate CDFs based only on name in lower case and length 63. If you get any duplicates here, you need to double-check that the Staging area database is created correctly.

PostgreSQL
SELECT
left(lower("public".customdefinedfield."name"), 63) AS max_length,
"public".customdefinedfield.entitytype,
Count("public".customdefinedfield.cdf_id)
FROM
"public".customdefinedfield
GROUP BY
max_length,
"public".customdefinedfield.entitytype
HAVING
Count("public".customdefinedfield.cdf_id) > 1
ORDER BY
1, 2
Depending on data type, etc. there might not be any error messages during the Staging area geo generation.

This query checks for Duplicate CDFs based only on name in lower case and length 31. If you get any duplicates here, you need to double-check that the Staging area geo database is created correctly and the column names used in the geo views are not confusing.

PostgreSQL
SELECT
left(lower("public".customdefinedfield."name"), 31) AS max_length,
"public".customdefinedfield.entitytype,
Count("public".customdefinedfield.cdf_id)
FROM
"public".customdefinedfield
GROUP BY
max_length,
"public".customdefinedfield.entitytype
HAVING
Count("public".customdefinedfield.cdf_id) > 1
ORDER BY
1, 2

{{#switch:|subgroup|child=|none=|#default=

}}{{#if:|}}{{#if:Upgrade Process|<td style="text-align:left;border-left-width:2px;border-left-style:solid;|{{#if:|}}}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:duplicate cdf

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}{{#if:|{{{group2}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list2}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:duplicate cdf

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}{{#if:|{{{group3}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list3}}}

}}{{#if:|{{#if:|{{{group4}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list4}}}

}}{{#if:|{{#if:|{{{group5}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list5}}}

}}{{#if:|{{#if:|{{{group6}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list6}}}

}}{{#if:|{{#if:|{{{group7}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list7}}}

}}{{#if:|{{#if:|{{{group8}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list8}}}

}}{{#if:|{{#if:|{{{group9}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list9}}}

}}{{#if:|{{#if:|{{{group10}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list10}}}

}}{{#if:|{{#if:|{{{group11}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list11}}}

}}{{#if:|{{#if:|{{{group12}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list12}}}

}}{{#if:|{{#if:|{{{group13}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list13}}}

}}{{#if:|{{#if:|{{{group14}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list14}}}

}}{{#if:|{{#if:|{{{group15}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list15}}}

}}{{#if:|{{#if:|{{{group16}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list16}}}

}}{{#if:|{{#if:|{{{group17}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list17}}}

}}{{#if:|{{#if:|{{{group18}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list18}}}

}}{{#if:|{{#if:|{{{group19}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list19}}}

}}{{#if:|{{#if:|{{{group20}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list20}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:duplicate cdf

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}

{{{below}}}

}}{{#switch:|subgroup|child=

|none=|#default=}}{{#ifeq:|Template|{{#ifeq:|child||{{#ifeq:|subgroup||{{#switch:duplicate cdf
|doc
|sandbox
|testcases =
|#default = {{#switch:hlist
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}