Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egZrS-0002RP-Tf for pgsql-general@arkaria.postgresql.org; Tue, 30 Jan 2018 17:38:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egZrR-0008MU-0M for pgsql-general@arkaria.postgresql.org; Tue, 30 Jan 2018 17:38:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egXvP-0000SN-2b for pgsql-general@lists.postgresql.org; Tue, 30 Jan 2018 15:34:19 +0000 Received: from smtp.emerald.synacor.com ([208.47.184.7] helo=smtp01.emerald.cmh.synacor.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egXvK-0008KB-Ci for pgsql-general@lists.postgresql.org; Tue, 30 Jan 2018 15:34:17 +0000 X_CMAE_Category: , , X-CNFS-Analysis: v=2.2 cv=FtdHxCjq c=1 sm=1 tr=0 a=sOJG561dOovE9JBqKNxcJA==:117 a=KGjhK52YXX0A:10 a=FKkrIqjQGGEA:10 a=Rjg61QVRfgoA:10 a=RgaUWeydRksA:10 a=qzyW-89uDWQA:10 a=nvhMdYX1sOkA:10 a=2wibhlOU01UA:10 a=epTmVMiNAAAA:8 a=8qSefF8wAAAA:8 a=pGLkceISAAAA:8 a=W-h8FiH9hRyGDoav83YA:9 a=QEXdDO2ut3YA:10 a=dNeibfhwy1iGRiXrMB8A:9 a=9glz3wbAUtZ2CnBo:21 a=_W_S_7VecoQA:10 a=tclcd6dtLQvEqt9_mmAA:9 a=ndEWmUVY6Yapc0oHF_P4:22 a=gy0usrHT_YHxg8cEKwfj:22 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine X-Authed-Username: YnRvYmVyQGJyb2Fkc3RyaXBlLm5ldA== X_CMAE_Category: , , X-CNFS-Analysis: X-CM-Score: X-Scanned-by: Cloudmark Authority Engine Authentication-Results: smtp01.emerald.cmh.synacor.com header.from=btober@broadstripe.net; sender-id=neutral Authentication-Results: smtp01.emerald.cmh.synacor.com smtp.mail=btober@broadstripe.net; spf=neutral; sender-id=neutral Received-SPF: neutral (smtp01.emerald.cmh.synacor.com: 10.33.73.65 is neither permitted nor denied by domain of broadstripe.net) Received: from [10.33.73.65] ([10.33.73.65:44916] helo=md03.emerald.cmh.synacor.com) by smtp.etc.emerald.synacor.com (envelope-from ) (ecelerity 3.6.1.42806 r(Platform:3.6.1.1)) with ESMTP id 38/1F-03937-470907A5; Tue, 30 Jan 2018 10:34:12 -0500 Date: Tue, 30 Jan 2018 10:34:12 -0500 (EST) From: "btober@computer.org" To: Elson Vaz Cc: pgsql-general@lists.postgresql.org Message-ID: <304712374.47914912.1517326452605.JavaMail.zimbra@broadstripe.net> In-Reply-To: References: Subject: Re: Alter view with dependence without drop view! MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_47914911_1402328657.1517326452605" X-Originating-IP: [8.44.100.11] X-Mailer: Zimbra 8.0.7_GA_6021 (ZimbraWebClient - FF52 (Win)/8.0.7_GA_6021) Thread-Topic: Alter view with dependence without drop view! Thread-Index: eF4YxldVg4U/XdhMqaJSMyw4xRf9WA== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_47914911_1402328657.1517326452605 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit One way I have approached this problem is: 1) Use PgAdmin attempt the change. 2) Examine the error report PgAdmin displays that identifies which dependent views are preventing your progress. 3) Wrap your original DDL from step 1 within the DROP and CREATE DDL associated with the closest dependent view. 4) Return to step 1 and repeat until step 1 succeeds. With multiple iterations of this procedure, you will incrementally grow a DDL script that drops dependent views in the correct order, eliminating dependencies, and then recreate them in the proper order, respecting dependencies. When this procedure got old, I started using a script created using pg_dump and pg_restore, as initially outlined here: https://www.postgresql.org/message-id/55C3F0B4.5010600@computer.org and with a correction noted here: https://www.postgresql.org/message-id/0456dfda-4623-1331-7dca-e3cff914357b%40computer.org -- B ----- Original Message ----- From: "Elson Vaz" To: pgsql-general@lists.postgresql.org Sent: Tuesday, January 30, 2018 8:40:45 AM Subject: Alter view with dependence without drop view! Hello! I want make change in one view that have dependence view's, so when i try to make change i'm block because of this, what is the best solution?? thank you!! best regard Elson Vaz ------=_Part_47914911_1402328657.1517326452605 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
One way I have approached this p= roblem is:

1) Use PgAdmin attempt the change.<= /div>

2) Examine the error report PgAdmin displays that = identifies which dependent views are preventing your progress.

3) Wrap your original DDL from step 1 within the DROP and = CREATE DDL associated with the closest dependent view.

4) Return to step 1 and repeat until step 1 succeeds.

With multiple iterations of this procedure, you will incr= ementally grow a DDL script that drops dependent views in the correct order= , eliminating dependencies, and then recreate them in the proper order, res= pecting dependencies.



When this procedure got old, I started using a script created using p= g_dump and pg_restore, as initially outlined here:

=

= and with a correction noted here:





-- = B



From: "Elson Vaz" <elso= nlei@gmail.com>
To: pgsql-general@lists.postgresql.org
S= ent: Tuesday, January 30, 2018 8:40:45 AM
Subject: Alter view= with dependence without drop view!

Hello!

I want make change in one view that have d= ependence view's, so when i try to make change i'm block because of this, w= hat is the best solution??

thank you!!
<= br>
best regard 

Elson Vaz

------=_Part_47914911_1402328657.1517326452605--