Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ksUI8-0005bS-T5 for pgsql-general@arkaria.postgresql.org; Thu, 24 Dec 2020 17:20:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ksUI6-00035U-RT for pgsql-general@arkaria.postgresql.org; Thu, 24 Dec 2020 17:20:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ksUI5-00035N-VO for pgsql-general@lists.postgresql.org; Thu, 24 Dec 2020 17:20:42 +0000 Received: from sonic311-14.consmr.mail.bf2.yahoo.com ([74.6.131.124]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ksUHy-0007gA-NM for pgsql-general@lists.postgresql.org; Thu, 24 Dec 2020 17:20:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1608830431; bh=UUC8z10Bv1IYLkDZYDsTIJeT2EdFrTZxN4T3oO8n3+8=; h=Date:From:To:Subject:References:From:Subject; b=rTOcKWMA7vqT28LiN1JvDzicrsLiUlaV2SguYpk+7OS7DGB58dxPfLrV9sJH5eJUi3OiBXX9e3hkBIWL50nXbY05THp9XlimlqROqkMWLVPmLAIALAbD7gcrD0Bb3tymkCnp7Kz+fK1E2pWhVBzP6Zy/bMBcdss1UPcZUcOeKG3G2t+tx2MaSKFJt84Uc8tbPb4DD0ATrs2V4asd7j88AyNMliunehwCujUgoQS3PVKD/Jw7Fu1HZ4axqjqBToaKWrKVn8GiGLEjvPAxmUXJ0jqFzP2eI/dy4Z0IAojbpWbnrYjl668022xFbg6waWV20r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zMp3obWdL_GYaSV.vJsEMZKMNaLno C.d2YxnqFlIL0HgC3R6g2QmVEkVFea.HcBOKty2rxPUggsJ8mqLLdsHwgQQl5rFEsiKYTZrelX9I zw0Uxd0IyZqOCXgGcbv2xf6z3ArQv74IfsyQqOq.l3E2dLo6DteW9wMemJeOYjBTneGUIgNrMGnF GddHyWmNvYQYVWPDnB_tBMiBNIdTK.9HJKAZXebJ.c_HqdKDiuNGeXTxNLWNBr0c_tIe7j4nYVfB wLhpzsRUkVNVqbcIdVds6ueDgvUxtrocaADVqUMjEFcJKyvoQS2WtSax.hvN8TacolS9DAnu3c5v vhjKwX5Iy0eKQrGGkyOfTsroJ9IDXBDo6YMet3IPsg8K4_GUIO_h00PKBjUhZrnJ00PeZytK5Mh4 wUD6JXS2YkPvVRJlPc8t4zIcE2OnkZ.LX9b2z2MglSvtYETixBZ8s_v7iIuJpM2izqtYI7knyTZh FJWBsH0iVOYpXIejljKiIHg_llu2YqGH1uAZITldatwOS1XYL5e9HOprZFvAX.sv8XnurmWomjP0 obSfQMrZRkhikXHlPngAyXj._XI9UteyY_OVlS16dI7raMKuKS60SbaFPoUUdvCyTM9e73JH46zF cMtkCUpV_ruqUTAM7h6SuH7nmCdQI4uy51X7HHI.0Oi1AwH9pG_2pVYemaNNeWucclewRe6Iv4Ok Vbk3U1qkL0qswk.7FH1BXgHQzzxqo_l5GH8916QeGyCet9kZAxYaRLlm_fzP4DJlZhOOaZCA.2.i UGRo51H7cfGMdHUWdyQJm_2SRZuseR2eO7xkpwo9Hs7h5QRVf8fci9m_LpUqy1xhai4MB Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Thu, 24 Dec 2020 17:20:31 +0000 Date: Thu, 24 Dec 2020 17:20:29 +0000 (UTC) From: Open _ To: "pgsql-general@lists.postgresql.org" Message-ID: <1957561924.2643508.1608830429291@mail.yahoo.com> Subject: created type not found in create table MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2643507_745331140.1608830429289" References: <1957561924.2643508.1608830429291.ref@mail.yahoo.com> X-Mailer: WebService/1.1.17278 YMailNorrin Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0 Content-Length: 21203 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2643507_745331140.1608830429289 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm using I have psql (PostgreSQL) 13.1 on centOS 7.1I do everything throug= h layers of bash scripts and bash script functions. So posting all the code would be huge. The scripts run as postgres Each script step tests if that object already exists before creating Each statement is a separate call to psqlSo each statement is a separate se= ssion The steps are:=C2=A0 create the database users =C2=A0 created a database "StaffDB"=C2=A0 (Yes with capitial letters becaus= e I want it that way)=C2=A0 created a schema "staffadmin"=C2=A0 (ok I gave = in and used lowercase for all except DB names)=C2=A0 set the search_path=C2= =A0 create 3 types=C2=A0 create a table using those 3 types=C2=A0 =C2=A0=C2= =A0 and it says type not found. Here is the output: 2020-12-24 16:18:54:=C2=A0 - bootstrap_StaffDB is running as postgres 2020-12-24 16:18:54: Step 0 - Create database users 2020-12-24 16:18:54: Creating StaffDB users 2020-12-24 16:18:55:=C2=A0 OptimusPrime already exists 2020-12-24 16:18:55:=C2=A0 Minerva already exists 2020-12-24 16:18:55:=C2=A0 BKuserUP already exists 2020-12-24 16:18:55:=C2=A0 StaffDB users complete 2020-12-24 16:18:55: StaffDB Step 1 Create StaffDB database 2020-12-24 16:18:55:=C2=A0=C2=A0 Start of create_database function for data= base: StaffDB 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 Creating the StaffDB Database =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 CREATE DATABASE "StaffDB" =C2=A0=C2=A0=C2=A0=C2=A0 with owner "XXXXXX" ; =C2=A0=C2=A0 CREATE DATABASE 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 StaffDB database created 2020-12-24 16:18:55: StaffDB Step 2 - grant database level perms =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 grant all privileges on database "StaffDB" to "XXXXXX"; =C2=A0=C2=A0 GRANT =C2=A0=C2=A0 grant connect, temp=C2=A0 on database "StaffDB" to "YYYYYY"; =C2=A0=C2=A0 GRANT =C2=A0=C2=A0 grant connect, temp=C2=A0 on database "StaffDB" to "ZZZZZZ"; =C2=A0=C2=A0 GRANT 2020-12-24 16:18:55: StaffDB Step 3 - create StaffAdmin schema and objects 2020-12-24 16:18:55:=C2=A0 Running /home/solid/DB/schema/postgres/StaffDB/s= taffadmin/boot_schema_StaffAdmin.inc 2020-12-24 16:18:55:=C2=A0 Starting to boot the StaffDB.staffadmin schema 2020-12-24 16:18:55: StaffDB:staffadmin - Step 1 - create schema 2020-12-24 16:18:55:=C2=A0=C2=A0 Start of create_schema function for databa= se: StaffDB 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 Creating the StaffDB.staffadmin sche= ma =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 CREATE SCHEMA if not exists staffadmin =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 authorization "XXXXX= X"; =C2=A0=C2=A0 CREATE SCHEMA 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 StaffDB.staffadmin schema created =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0=C2=A0=C2=A0 show search_path ; =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 search_path =C2=A0=C2=A0 ----------------- =C2=A0=C2=A0=C2=A0 "$user", public =C2=A0=C2=A0 (1 row) =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0=C2=A0=C2=A0 alter role postgres in database "StaffDB" set sear= ch_path =3D 'staffadmin'; =C2=A0=C2=A0 ALTER ROLE =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0=C2=A0=C2=A0 show search_path ; =C2=A0=C2=A0=C2=A0 search_path =C2=A0=C2=A0 ------------- =C2=A0=C2=A0=C2=A0 staffadmin =C2=A0=C2=A0 (1 row) 2020-12-24 16:18:55: StaffDB:staffadmin - Step 2 - grant schema privileges 2020-12-24 16:18:55: StaffDB:staffadmin - Step 3 - Create StaffAdmin Types 2020-12-24 16:18:55:=C2=A0=C2=A0 Start of create_type function for StaffDB = nully 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 Creating the StaffDB nully type =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 CREATE TYPE staffadmin.nully =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 as ENUM ('','Y') ; =C2=A0=C2=A0 CREATE TYPE 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 StaffDB nully type created 2020-12-24 16:18:55:=C2=A0=C2=A0 Start of create_type function for StaffDB = staff_roll 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 Creating the StaffDB staff_roll type =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 CREATE TYPE staffadmin.staff_roll =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 as ENUM ('Not yet defined', 'Everythin= g', 'Sys Admin', 'Developer', 'DBA', 'Security', 'Art & Apperance', 'Suppor= t', 'Manager') ; =C2=A0=C2=A0 CREATE TYPE 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 StaffDB staff_roll type created 2020-12-24 16:18:55:=C2=A0=C2=A0 Start of create_type function for StaffDB = staff_status 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 Creating the StaffDB staff_status ty= pe =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 CREATE TYPE staffadmin.staff_status =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 as ENUM ('New since','Active since', '= Off-line until', 'Exited on' ) ; =C2=A0=C2=A0 CREATE TYPE 2020-12-24 16:18:55:=C2=A0=C2=A0=C2=A0 StaffDB staff_status type created 2020-12-24 16:18:55: StaffDB:staffadmin - Step 4 - Create Staff Table 2020-12-24 16:18:55:=C2=A0 Starting create_table_staff.inc 2020-12-24 16:18:55:=C2=A0=C2=A0 Creating the staffdb.staffadmin.staff tabl= e =C2=A0=C2=A0 \set ON_ERROR_STOP on =C2=A0=C2=A0 CREATE=C2=A0 TABLE IF NOT EXISTS staffadmin.staff ( =C2=A0=C2=A0=C2=A0=C2=A0 staff_id=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 serial=C2=A0=C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 NOT NULL , =C2=A0=C2=A0=C2=A0=C2=A0 shortname=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 varCHAR(12)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 fullname=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 varCHAR(48)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 created=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 timeSTAMP=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 role=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 staffadmin.staff_role=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 status=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 staffadmin.staff_status NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 status_date=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 DATE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 email=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 varCHAR(60)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 email_verified staffadmin.nully=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 null , =C2=A0=C2=A0=C2=A0=C2=A0 login_cnt=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 integer=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 NOT null DEFAULT '0', =C2=A0=C2=A0=C2=A0=C2=A0 last_login=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeSTAMP= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEFAULT null ); =C2=A0=C2=A0 psql:/tmp/psql_tmp.5133.sql:16: ERROR:=C2=A0 type "staffadmin.= staff_role" does not exist =C2=A0=C2=A0 LINE 9:=C2=A0=C2=A0 role=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 staffadmin.staff_role=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ^ 2020-12-24 16:18:56: __ ERROR __ Statement Failure While creating StaffDB.s= taffadmin.staff table 2020-12-24 16:18:56: __ ERROR __ - Thu -=C2=A0 Script bootstrap_StaffDB FAI= LED=C2=A0=C2=A0 EXIT_CD=3D10 I get the same error if I remove the staffadmin schema specifier from the c= olumn lines in the create table statement. =C2=A0=C2=A0=C2=A0=C2=A0 role=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 staff_role=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 status=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 staff_status=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 status_date=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 DATE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 email=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 varCHAR(60)=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0 email_verified nully=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nu= ll , =C2=A0=C2=A0=C2=A0=C2=A0 login_cnt=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 integer=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 NOT null DEFAULT '0', =C2=A0=C2=A0=C2=A0=C2=A0 last_login=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 timeSTAMP= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 DEFAULT null ); =C2=A0=C2=A0 psql:/tmp/psql_tmp.10244.sql:16: ERROR:=C2=A0 type "staff_role= " does not exist =C2=A0=C2=A0 LINE 9:=C2=A0=C2=A0 role=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 staff_role=C2=A0=C2=A0 NOT null , =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ^ ------=_Part_2643507_745331140.1608830429289 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
=
I'm using
I have psql (PostgreSQL) 13.1 on centOS 7.1<= /div>
I do everything through l= ayers of bash scripts and bash script functions.
So po= sting all the code would be huge.

<= div dir=3D"ltr" data-setdir=3D"false">The scripts run as postgres
=

Each scri= pt step tests if that object already exists before creating
Each statement is a separate = call to psql
So ea= ch statement is a separate session


The steps= are:
  creat= e the database users
  created a database "StaffDB"  (Yes with capitial l= etters because I want it that way)
  created a schema "staffadmin"  (ok I gave in and used lower= case for all except DB names)
&= nbsp; set the search_path
 = ; create 3 types
  create = a table using those 3 types
&nb= sp;    and it says type not found.

Here is the = output:
2020-12-24 16:18:54:  - bootstrap_StaffDB is running as = postgres
2020-12-24 16:18:54: Step 0 - Create database users
2020-12-= 24 16:18:54: Creating StaffDB users
2020-12-24 16:18:55:  OptimusPr= ime already exists
2020-12-24 16:18:55:  Minerva already exists
= 2020-12-24 16:18:55:  BKuserUP already exists
2020-12-24 16:18:55:&= nbsp; StaffDB users complete
2020-12-24 16:18:55: StaffDB Step 1 Create = StaffDB database
2020-12-24 16:18:55:   Start of create_databa= se function for database: StaffDB
2020-12-24 16:18:55:   = Creating the StaffDB Database

   \set ON_ERROR_STOP on   CREATE DATABASE "StaffDB"
     with ow= ner "XXXXXX" ;
   CREATE DATABASE

2020-12-24 16:18:55:&= nbsp;   StaffDB database created
2020-12-24 16:18:55: StaffDB = Step 2 - grant database level perms

   \set ON_ERROR_STOP = on
   grant all privileges on database "StaffDB" to "XXXXXX";<= br>   GRANT
   grant connect, temp  on database= "StaffDB" to "YYYYYY";
   GRANT
   grant connect= , temp  on database "StaffDB" to "ZZZZZZ";
   GRANT
2020-12-24 16:18:55: StaffDB Step 3 - create StaffAdmin schema and object= s
2020-12-24 16:18:55:  Running /home/solid/DB/schema/postgres/Staf= fDB/staffadmin/boot_schema_StaffAdmin.inc
2020-12-24 16:18:55:  Sta= rting to boot the StaffDB.staffadmin schema
2020-12-24 16:18:55: StaffDB= :staffadmin - Step 1 - create schema
2020-12-24 16:18:55: &nbs= p; Start of create_schema function for database: StaffDB
2020-12-24 16:1= 8:55:    Creating the StaffDB.staffadmin schema

 = ;  \set ON_ERROR_STOP on
   CREATE SCHEMA if not exists s= taffadmin
          authori= zation "XXXXXX";
   CREATE SCHEMA

2020-12-24 16:18:55:&= nbsp;   StaffDB.staffadmin schema created

   \se= t ON_ERROR_STOP on
     show search_path ;
 =      search_path
   -----------------
&= nbsp;   "$user", public
   (1 row)


 =   \set ON_ERROR_STOP on
     alter role postgre= s in database "StaffDB" set search_path =3D 'staffadmin';
   A= LTER ROLE


   \set ON_ERROR_STOP on
  &nbs= p;  show search_path ;
    search_path
 &nbs= p; -------------
    staffadmin
   (1 row)
2020-12-24 16:18:55: St= affDB:staffadmin - Step 2 - grant schema privileges
2020-12-24 16:18:55:= StaffDB:staffadmin - Step 3 - Create StaffAdmin Types
2020-12-24 16:18:= 55:   Start of create_type function for StaffDB nully
2020-12-= 24 16:18:55:    Creating the StaffDB nully type

 = ;  \set ON_ERROR_STOP on
   CREATE TYPE staffadmin.nully<= br>       as ENUM ('','Y') ;
   = CREATE TYPE

2020-12-24 16:18:55:    StaffDB nully typ= e created
2020-12-24 16:18:55:   Start of create_type function= for StaffDB staff_roll
2020-12-24 16:18:55:    Creating = the StaffDB staff_roll type

   \set ON_ERROR_STOP on
&n= bsp;  CREATE TYPE staffadmin.staff_roll
    &nb= sp;  as ENUM ('Not yet defined', 'Everything', 'Sys Admin', 'Developer= ', 'DBA', 'Security', 'Art & Apperance', 'Support', 'Manager') ;
&nb= sp;  CREATE TYPE

2020-12-24 16:18:55:    StaffDB= staff_roll type created
2020-12-24 16:18:55:   Start of creat= e_type function for StaffDB staff_status
2020-12-24 16:18:55:  = ;  Creating the StaffDB staff_status type

   \set ON_= ERROR_STOP on
   CREATE TYPE staffadmin.staff_status
 =       as ENUM ('New since','Active since', 'Off-li= ne until', 'Exited on' ) ;
   CREATE TYPE

2020-12-= 24 16:18:55:    StaffDB staff_status type created
2020-12= -24 16:18:55: StaffDB:staffadmin - Step 4 - Create Staff Table
2020-12-2= 4 16:18:55:  Starting create_table_staff.inc
2020-12-24 16:18:55:&n= bsp;  Creating the staffdb.staffadmin.staff table

   = \set ON_ERROR_STOP on
   CREATE  TABLE IF NOT EXISTS staffadmin.s= taff (
     staff_id     &n= bsp;     serial        &n= bsp;     NOT NULL ,
     shortna= me         varCHAR(12)  &= nbsp;       NOT null ,
   &= nbsp; fullname          varCHA= R(48)          NOT null ,
&= nbsp;    created       &n= bsp; timeSTAMP          &= nbsp;   NOT null ,
     role  &n= bsp;        staffadmin.staff_role &= nbsp; NOT null ,
     status    =      staffadmin.staff_status NOT null ,
  =    status_date        &nb= sp; DATE           &= nbsp;  NOT null ,
     email   &= nbsp;         varCHAR(60) &nbs= p;        NOT null ,
  &nbs= p;  email_verified staffadmin.nully      = ;      null ,
     login_cn= t         integer   =            NOT null DEFAU= LT '0',
     last_login     = ; timeSTAMP          DEFAULT n= ull );

   psql:/tmp/psql_tmp.5133.sql:16: ERROR:&nbs= p; type "staffadmin.staff_role" does not exist
   LINE 9: &nb= sp; role           staffa= dmin.staff_role   NOT null ,
     &nb= sp;            =           ^


2020= -12-24 16:18:56: __ ERROR __ Statement Failure While creating StaffDB.staff= admin.staff table
2020-12-24 16:18:56: __ ERROR __ - Thu -  Script = bootstrap_StaffDB FAILED   EXIT_CD=3D10


I get the same error if I remove = the staffadmin schema specifier from the column lines in the create table s= tatement.

     role &n= bsp;         staff_role   = ;           NOT null ,
    = status         staff_status &= nbsp;          NOT null ,
&= nbsp;    status_date      &nbs= p;   DATE         &n= bsp;    NOT null ,
     email &n= bsp;           varCHAR(60= )          NOT null ,
 = ;    email_verified nully      = ;                 null ,<= br>     login_cnt      &n= bsp;  integer         &nb= sp;    NOT null DEFAULT '0',
     las= t_login      timeSTAMP    &nbs= p;     DEFAULT null );
   psql:/tmp/psql_t= mp.10244.sql:16: ERROR:  type "staff_role" does not exist
 &nb= sp; LINE 9:   role        = ;   staff_role   NOT null ,
    =             &nb= sp;           ^



------=_Part_2643507_745331140.1608830429289--