Details
-
Bug
-
Status: Closed (View Workflow)
-
P2
-
Resolution: Done
-
None
-
-
eHoldings Sprint 125
-
1
-
Spitfire
-
R3 2021 Bug Fix
Description
Migrating mod-source-record-manager fails with this error
{ "message": "type \"rule_type\" already exists", "severity": "ERROR", "code": "42710", "where": "SQL statement \"create type rule_type AS ENUM ('MARC_BIB', 'MARC_HOLDING')\" PL/pgSQL function inline_code_block line 1 at SQL statement", "file": "typecmds.c", "line": "1191", "routine": "DefineEnum" }"
while executing this snippet:
{ "run": "after", "snippet": "DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type t JOIN pg_enum e ON t.oid = e.enumtypid JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace WHERE t.typname = 'rule_type' AND n.nspname = '${myuniversity}_${mymodule}') THEN create type rule_type AS ENUM ('MARC_BIB', 'MARC_HOLDING'); END IF; END $$; ALTER TABLE mapping_rules ADD COLUMN IF NOT EXISTS record_type rule_type NOT NULL DEFAULT 'MARC_BIB';", "fromModuleVersion": "mod-source-record-manager-3.2.0" }
A snippet in schema.json must be a single line. This is the snipped reformatted for readability to help with debugging this issue:
DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type t JOIN pg_enum e ON t.oid = e.enumtypid JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace WHERE t.typname = 'rule_type' AND n.nspname = '${myuniversity}_${mymodule}') THEN create type rule_type AS ENUM ('MARC_BIB', 'MARC_HOLDING'); END IF; END $$; ALTER TABLE mapping_rules ADD COLUMN IF NOT EXISTS record_type rule_type NOT NULL DEFAULT 'MARC_BIB';
The log shows that the placeholderĀ ${myuniversity}_${mymodule} is NOT replaced by the actual values:
trying to execute: {} DO $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type t JOIN pg_enum e ON t.oid = e.enumtypid JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace WHERE t.typname = 'rule_type' AND n.nspname = '${myuniversity}_${mymodule}') THEN create type rule_type AS ENUM ('MARC_BIB', 'MARC_HOLDING'); END IF; END $$; ALTER TABLE mapping_rules ADD COLUMN IF NOT EXISTS record_type rule_type NOT NULL DEFAULT 'MARC_BIB';"
TestRail: Results
Attachments
Issue Links
- blocks
-
MODSOURMAN-585 Release v3.2.1 (R3 Kiwi Bugfix)
-
- Closed
-
- is cloned by
-
RMB-877 Schema name can't replace in snippet (schema.json)
-
- Closed
-
- relates to
-
UXPROD-3167 Kiwi | Spitfire | quickMARC enhancements
-
- Closed
-