Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hyjif-0002Yu-0m for pgsql-general@arkaria.postgresql.org; Fri, 16 Aug 2019 21:25:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hyjid-00014J-5x for pgsql-general@arkaria.postgresql.org; Fri, 16 Aug 2019 21:25:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hyjib-0000si-1B for pgsql-general@lists.postgresql.org; Fri, 16 Aug 2019 21:25:06 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hyjiX-00048H-QI for pgsql-general@lists.postgresql.org; Fri, 16 Aug 2019 21:25:03 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0B05F43B; Fri, 16 Aug 2019 17:24:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 16 Aug 2019 17:25:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=R cnjYk77phzC5e0lEE2uy3ouzl2L0YkPqvj+KSJpjwE=; b=F1VKiyuatgRZvooXu LO41CI92jB6k5COB+k34glXml1Sz+Q2n0hE0+PD3zj5maTEsa4izjuRgSxzBn+Vo VsoysW1k/8REuyVfnes/9yLzSrzZeR/2IswIQBHzB04lnFmPCaEGyxZK727T2ICd N9JvZBAV6xixLEyHY4IiwuoKsN2VI1eNaI5bA0J/xCjjnGn2efT+MZtpJkVTqpaF xUUn6/u4dKE1/bydbjosKi3grtmDPpOWLctr2CAGdQBH3tcsoY/Epj9E3woAXOKh T6p/JqgR5g6ckk0YM3PNhnqjDhZy9RDRfytM6Mk6UTkGfROq/Khr79EBO0wvzbG9 AZuHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=RcnjYk77phzC5e0lEE2uy3ouzl2L0YkPqvj+KSJpj wE=; b=FPe1Y2pUJ3H9Ea3mQLO9dd4oLw4WZHxwTkqJWHfUKXE50YkNKj6toQ94d to2Fjxsgu7YTQcRVj0RTwQtgD1GfLikMKL/U4jQLIfwqfz6kja9xikjJwzo+ZyQz K28HHZi2pDToCfmZDuqaHapmitGJZuQ7DBXzBGm8E3Yc7IJiQECMgxDpn3TycoC7 wVym7E+K0qG4IsXwJf6j1yycmE33NUnYu7y1XZS3RzKCChSEpG5E1hUeFxvIFfFJ l9HQsqx0F4fxOxRXm7/Pk8Sd3TpT1wLDhs1cTnsLabr+iFgVPCw8AVKj32MaOebu IoiJTfRdOfGz+W0KTzRScxMe8CeIg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeffedgudehjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesth ekredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucfkphepjeefrddvfeelrdduudejrd dvfeeknecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegr khhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id C0C7780064; Fri, 16 Aug 2019 17:24:58 -0400 (EDT) Subject: Re: Missing Trigger after pgdump install To: susan.hurst@brookhurstdata.com, pgsql-general@lists.postgresql.org References: <53f9ff4448f5210802b5a04c8fa83186@mail.brookhurstdata.net> <40cc8a45-5276-b64f-3ad8-a39865bb2a21@aklaver.com> <059bade8075a3c2e17ad75baf4e399b0@mail.brookhurstdata.net> From: Adrian Klaver Message-ID: <79a8cb5c-d5d9-7dcb-35d2-08947aa5fbcb@aklaver.com> Date: Fri, 16 Aug 2019 14:24:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <059bade8075a3c2e17ad75baf4e399b0@mail.brookhurstdata.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/16/19 1:00 PM, Susan Hurst wrote: > The dump command used by the DBA to create the pgdump file is: > > pg_dump --clean --if-exists --create --format=plain --no-owner > --no-tablespaces \ >         --file=${BKUPDIR}/${TS}.${USER}.pg 2>&1        \ >        | tee -a  ${LOGDIR}/${TS}_biar_dump.log > > No noticeable difference when -b is added, but we're not sure what this > is for.  What should we look for? This should echo the errors below. Not sure where that actually ends up on Windows. What are the versions of Postgres you are using on the dump/restore ends? > Here is a snippet from the postgres server log that shows an error > message that the view devops.subscribers does not exist, however > according to the line numbers the view was created before the trigger. > > Error from Postgres server log (postgresql-2019-08-16_140110.log): > 2019-08-16 14:04:24 CDT ERROR:  relation "devops.subscribers" does not > exist > 2019-08-16 14:04:24 CDT STATEMENT:  create trigger subscribers_iur_trg >                  instead of update >                  on devops.subscribers >                  for each row >                  execute procedure devops.subscribers_update(); > > CREATE VIEW subscribers appears on line 11,968 in the dump file > > > CREATE FUNCTION subscribers_update() appears on line 2,466 > > > CREATE TRIGGER subscribers_iur_trg appears on line 5,457,362 > > --- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Susan E Hurst > Principal Consultant > Brookhurst Data LLC > Email: susan.hurst@brookhurstdata.com > Mobile: 314-486-3261 > > On 2019-08-16 13:37, Adrian Klaver wrote: >> On 8/16/19 11:27 AM, Susan Hurst wrote: >>> What scenarios can cause a single trigger to be omitted when >>> populating an empty database from a pgdump file? >>> >>> We have nightly backups of our production database that we load into >>> a fresh, empty database in our sandbox using the pgdump file. >>> >>> psql.exe -h localhost -U mi601db -p 5432 -o >>> C:db_create_output.txt -L C:\\db_create_log.txt >>> -d skyfall < C:\mi601db.pg >> >> What is the dump command? >> >> What happens if you add -b to above? >> >> Which log file are you referring to below, the one generated above or >> the Postgres server log? >> >>> >>> All objects and data appear in the new database as expected, except >>> for a single trigger named subscribers_iur_trg.  The trigger exists >>> in production and in the pgdump file.  I can add it manually with no >>> errors but it's always missing after our automated process.  Nothing >>> useful appears in the log file. The dependent function, >>> devops.subscribers_update() is present and accounted for as is the >>> view, devops.subscribers. >>> >>> CREATE TRIGGER subscribers_iur_trg >>>    INSTEAD OF UPDATE >>>    ON devops.subscribers >>>    FOR EACH ROW >>>    EXECUTE PROCEDURE devops.subscribers_update(); >>> >>> We've checked everything we can think of but we're still missing the >>> trigger every day. >>> >>> Thanks for your help! >>> >>> Sue > > -- Adrian Klaver adrian.klaver@aklaver.com