norBIT / alkisimport

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

PostgreSQL 16.3: function array_cat(anyarray, anyarray) does not exist #84

Closed gregorhd closed 2 months ago

gregorhd commented 3 months ago

Ich versuche sächsische ALKIS Daten in eine PostgreSQL 16.3/PostGIS 3.4 Datenbank zu importieren, mithilfe der GUI v4.0-3. Funktionierte vor ein paar Jahren einwandfrei (auf PostgreSQL 12). Nun kommt dieser Fehler:

2024-07-02T20:27:16 > psql:alkis-functions.sql:427: ERROR:  function array_cat(anyarray, anyarray) does not exist|
2024-07-02T20:27:16 > psql:alkis-functions.sql:427: STATEMENT:  CREATE AGGREGATE "public".alkis_accum (anyarray) (|
2024-07-02T20:27:16 >   sfunc = array_cat,|
2024-07-02T20:27:16 >   stype = anyarray,|
2024-07-02T20:27:16 >   initcond = '{}'|
2024-07-02T20:27:16 > );|
2024-07-02T20:27:16 Fehler bei Prozeß: 3
2024-07-02T20:27:16 Anlegen des Datenbestands schlug fehl.

Ich vermute, es handelt sich um einen Kompatibilitätsfehler da die compatibility notes von PG14 folgendes erwähnen:

User-defined objects that reference certain built-in array functions along with their argument types must be recreated (Tom Lane)

Specifically, array_append(), array_prepend(), array_cat(), array_position(), array_positions(), array_remove(), array_replace(), and width_bucket() used to take anyarray arguments but now take anycompatiblearray. Therefore, user-defined objects like aggregates and operators that reference those array function signatures must be dropped before upgrading, and recreated once the upgrade completes.

EDIT: Ich habe die Funkton nun manuell hinzugefügt, und der Import hat zumindest teilweise funktioniert (DB ist 1.6GB groß vs. 5.1GB an NAS XMLs):


CREATE FUNCTION array_cat(anyarray, anyarray) RETURNS anyarray
LANGUAGE SQL IMMUTABLE STRICT
AS $$
SELECT $1 || $2;
$$;

Viele Fehler in der Log-Datei mit diesem Output am Ende:

2024-07-05T09:45:57 > Politische Grenze werden verschmolzen| 2024-07-05T09:45:57 > psql:postprocessing.d/1_ableitungsregeln/11002.sql:227: NOTICE: adfs:{7101} sn:2016 n:0| 2024-07-05T09:45:57 > psql:postprocessing.d/1_ableitungsregeln/11002.sql:227: ERROR: function array_cat(integer[], integer[]) is not unique| 2024-07-05T09:45:57 > LINE 1: doneadfs := array_cat(doneadfs, adf.adfs)| 2024-07-05T09:45:57 > HINT: Could not choose a best candidate function. You might need to add explicit type casts.| 2024-07-05T09:45:57 > QUERY: doneadfs := array_cat(doneadfs, adf.adfs)| 2024-07-05T09:45:57 > CONTEXT: PL/pgSQL function pg_temp_6.alkis_besondereflurstuecksgrenze(boolean) line 43 at assignment| 2024-07-05T09:45:57 > psql:postprocessing.d/1_ableitungsregeln/11002.sql:227: STATEMENT: SELECT pg_temp.alkis_besondereflurstuecksgrenze(false);| 2024-07-05T09:45:57 Fehler bei Prozeß: 3 2024-07-05T09:45:57 postprocessing.d\1_ableitungsregeln\11002.sql gescheitert. 2024-07-05T09:45:57 Import nach 14h11m18s abgebrochen.

jef-n commented 2 months ago

Diese Anpassung wurde in a1414399d924 gemacht. alkis-import-4.0-3 war 3d3a83486 und ist veraltet.