norBIT / alkisimport

ALKIS-Import
http://www.norbit.de/68/
GNU General Public License v2.0
28 stars 17 forks source link

alkis_farben definiert Unique Constraint auf nullable Spalten #55

Closed ewie closed 1 year ago

ewie commented 1 year ago

Mir ist aufgefallen, dass alkis_farben mit UNIQUE(c, y, m, k) definiert ist, obwohl die vier Spalten nullable sind. Ich denke mal, dass die CMYK- und auch RGB-Werte generell nicht nullable sein sollten (unabhängig vom Unique Constraint).

Die Query, mit der ich meine Datenbanken nach solchen Fällen durchsucht habe:

select
  k.conrelid::regclass,
  k.conname,
  array_agg(a.attname order by a.attnum) as attnames
from
  pg_constraint k
  cross join
    unnest(k.conkey) keyattnum
  join
    pg_attribute a
      on a.attrelid = k.conrelid
      and a.attnum = keyattnum
      and not a.attnotnull
where
  k.contype = 'u'
group by
  1, 2
jef-n commented 1 year ago

alkis_farben hat statischen Inhalt.

ewie commented 1 year ago

Danke. Ich hätte gedacht, es lassen sich Farben nachträglich eintragen.