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 1jO0Uz-0008HA-Et for pgadmin-hackers@arkaria.postgresql.org; Mon, 13 Apr 2020 14:55: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 1jO0Uy-0000Ah-A9 for pgadmin-hackers@arkaria.postgresql.org; Mon, 13 Apr 2020 14:55:44 +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 1jO0Ux-00007F-T5 for pgadmin-hackers@lists.postgresql.org; Mon, 13 Apr 2020 14:55:44 +0000 Received: from mail-io1-xd42.google.com ([2607:f8b0:4864:20::d42]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jO0Uu-0006YF-Ll for pgadmin-hackers@postgresql.org; Mon, 13 Apr 2020 14:55:43 +0000 Received: by mail-io1-xd42.google.com with SMTP id i3so9538311ioo.13 for ; Mon, 13 Apr 2020 07:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I7ont+TaIYY5IY5ErCQ3hBUaPYoT2QG4wpC/x0zuNNI=; b=ru1iqDPYd57gkXhL40PDTCsPX6sdMSF6mJRc750mxbQ0Jet30fxGPDC+gjUwUByYnX FpTlCYetlsjppEFniEw23o0nHXGsSU6LukqgCdbUj3k2zXZu7BsPvrcdsN/R82viSXy6 MFjKdOXE0AcJJU55rsZLGOgjIDcolQ9lEkNoh7cdY1vldA9lgG9HEsbcOPlAeJSCjhWX /Iao3V6MZOjjCGp9jhzf4FLN6OwuJc8IIM2rq/rwNbZXVOcrp/D4D+ZY1NsEHhgvYIWH B3CMb2e/nozsUmnIPqerjBRmd6SOI8DgvRIoEa46G77tbV+/AocuGoBrB56P3u2SgZ6+ vQdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I7ont+TaIYY5IY5ErCQ3hBUaPYoT2QG4wpC/x0zuNNI=; b=Y8HiI2cc9BD8JKgNeIkliJZvT1bIEswtM8m76CDEFFuCqreXrHFzbY13SB52bdw16a dRdvQ+VitcLj20SnIh+M1TNoXI9UGVxl9zctipRNBG5Ase+X+64mjS4Qjdmmfv2tjlWL 2ikzRiHe2VPFubs/loRw4FzaIe2ySnocufPd+yaXotBf9a/CzsAyPfsaSzgiOJjY+tbx YvUxij5x0kqhqmpvepddhJ1C2VfMCiF/xj6w0u4ZLgWAPLTkTGQfSvWEUHErB9u0nUBf NPtJlrsvJmVVdyTeafzs3XBk6fNFU81fxllF9t1jy071wp0sRlHHKexlxvWbO5sSe5R3 AQ0g== X-Gm-Message-State: AGi0PuYRkULyvdKuofMRO3szlElzPgSKUJK9n0Ll73HwnlPVOfzb4qjv xmCXFqRujXwvrCO/ZIAvLtbhfz0G0ALsTLSMmznf7q+fvLTbybDebozXmNO4bBkJE1BcgvOYPeN i9lcNJdi/FpzVJMfIi3kxcJzVMwW4FYLHOpNoQLwkc/wDl+3vMDcwmfUYoCPE7M/alojIdxCY/h 3upIRWxbB+On/R1JzTHx/DDLzbkKgXIlZtKYthRWzOQ0zpPzggLGs= X-Google-Smtp-Source: APiQypK0yi7NUG89sJCNt2jgB8WRCaWqDzd+6urkvuktzzQ2KU44aSTsgtYkQXubXMIyD3WjsM/tQSsI3OJMatdSY3k= X-Received: by 2002:a6b:fc0d:: with SMTP id r13mr16830980ioh.18.1586789738758; Mon, 13 Apr 2020 07:55:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Akshay Joshi Date: Mon, 13 Apr 2020 20:25:27 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: RM 5053 - Getting an error while changing the columns in the existing view To: Khushboo Vashi Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000b65b5605a32d4611" X-CLOUD-SEC-AV-Info: edb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000b65b5605a32d4611 Content-Type: text/plain; charset="UTF-8" Thanks, patch applied. On Mon, Apr 13, 2020 at 2:29 PM Khushboo Vashi < khushboo.vashi@enterprisedb.com> wrote: > Hi, > > Please find the attached patch to fix the test cases due to this patch. > Also, this functionality will not be applicable on EPAS server as we can > change the view definition without dropping it. > > Thanks, > Khushboo > > On Wed, Apr 8, 2020 at 11:42 AM Akshay Joshi < > akshay.joshi@enterprisedb.com> wrote: > >> Thanks, patch applied. >> >> On Wed, Apr 8, 2020 at 10:58 AM Khushboo Vashi < >> khushboo.vashi@enterprisedb.com> wrote: >> >>> Hi Akshay, >>> >>> Please find the attached updated patch. >>> >>> Thanks, >>> Khushboo >>> >>> On Tue, Apr 7, 2020 at 11:43 AM Akshay Joshi < >>> akshay.joshi@enterprisedb.com> wrote: >>> >>>> Hi Khushboo >>>> >>>> The warning message is not showing up. Please fix and resend the patch. >>>> >>>> On Tue, Apr 7, 2020 at 10:00 AM Khushboo Vashi < >>>> khushboo.vashi@enterprisedb.com> wrote: >>>> >>>>> Hi Akshay, >>>>> >>>>> Please find the attached updated patch. >>>>> >>>>> On Tue, Mar 24, 2020 at 2:47 PM Akshay Joshi < >>>>> akshay.joshi@enterprisedb.com> wrote: >>>>> >>>>>> Hi Khushboo >>>>>> >>>>>> On Tue, Mar 24, 2020 at 1:47 PM Khushboo Vashi < >>>>>> khushboo.vashi@enterprisedb.com> wrote: >>>>>> >>>>>>> Hi Akshay, >>>>>>> >>>>>>> On Tue, Jan 14, 2020 at 11:47 AM Akshay Joshi < >>>>>>> akshay.joshi@enterprisedb.com> wrote: >>>>>>> >>>>>>>> Hi Khushboo >>>>>>>> >>>>>>>> Following are the review comments: >>>>>>>> >>>>>>>> - Fix the PEP8 issue. >>>>>>>> - Drop query should be part of the jinja template for >>>>>>>> consistency. Currently, it is added through the python file. >>>>>>>> >>>>>>>> The Delete query is already in the template file, I have just >>>>>>> reused the delete call and merged the SQL queries in the python file. >>>>>>> >>>>>>>> >>>>>>>> - Any changes in the view code should not warn the user >>>>>>>> "Changing the columns in a view requires dropping...." and we should not >>>>>>>> drop the view. For example, I have only change the WHERE clause or added >>>>>>>> 'ORDER BY'. >>>>>>>> >>>>>>>> I have tested but couldn't reproduce this issue. Can you please >>>>>>> let me know the proper use case? >>>>>>> >>>>>> >>>>>> Create a view with 'SELECT 1;' as code. Then change the code to >>>>>> 'SELECT 1234;' and click on the Save button. >>>>>> Warning popup is displayed "Changing the columns in a view....". >>>>>> Click on the 'Yes' button and check the OID of the view. You will get the >>>>>> same OID, it means view is not recreated. >>>>>> >>>>>> >>>>> I can reproduce this issue with the given SQL but the problem is as >>>>> per the PostgreSQL documentation, (Ref: >>>>> https://www.postgresql.org/docs/12/sql-createview.html) >>>>> >>>>> "CREATE OR REPLACE VIEW is similar, but if a view of the same name >>>>> already exists, it is replaced. The new query must generate the same >>>>> columns that were generated by the existing view query (that is, the same >>>>> column names in the same order and with the same data types), but it may >>>>> add additional columns to the end of the list. The calculations giving rise >>>>> to the output columns may be completely different." >>>>> >>>>> So, I put a check on the columns and if the column is changed, the >>>>> message will popup. >>>>> >>>>> In case of the example given by you, the column name is not changed as >>>>> if you don't give the column name it will be default and I think view would >>>>> have the column names properly. >>>>> >>>>> >>>>>> I have observed below error in the browser while changing the >>>>>> code: >>>>>> view.js:241 Uncaught TypeError: Cannot read property >>>>>> 'replace' of undefined >>>>>> at child.onChange (view.js:241) >>>>>> at HTMLDivElement.dispatch (jquery.js:5237) >>>>>> at HTMLDivElement.elemData.handle (jquery.js:5044) >>>>>> >>>>>> Fixed. >>>>> >>>>> Thanks, >>>>> Khushboo >>>>> >>>>>> >>>>>>> Thanks, >>>>>>> Khushboo >>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>>> On Tue, Jan 14, 2020 at 10:27 AM Khushboo Vashi < >>>>>>>> khushboo.vashi@enterprisedb.com> wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> Please find the attached patch for RM #5053 - Getting an error >>>>>>>>> while changing the columns in the existing view. >>>>>>>>> >>>>>>>>> PostgreSQL doesn't allow to change the view columns. So, while >>>>>>>>> performing this task the existing view should be dropped first and then >>>>>>>>> recreate it and also user will get a warning first. >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Khushboo >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> *Thanks & Regards* >>>>>>>> *Akshay Joshi* >>>>>>>> >>>>>>>> *Sr. Software Architect* >>>>>>>> *EnterpriseDB Software India Private Limited* >>>>>>>> *Mobile: +91 976-788-8246* >>>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> *Thanks & Regards* >>>>>> *Akshay Joshi* >>>>>> >>>>>> *Sr. Software Architect* >>>>>> *EnterpriseDB Software India Private Limited* >>>>>> *Mobile: +91 976-788-8246* >>>>>> >>>>> >>>> >>>> -- >>>> *Thanks & Regards* >>>> *Akshay Joshi* >>>> >>>> *Sr. Software Architect* >>>> *EnterpriseDB Software India Private Limited* >>>> *Mobile: +91 976-788-8246* >>>> >>> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > -- *Thanks & Regards* *Akshay Joshi* *Sr. Software Architect* *EnterpriseDB Software India Private Limited* *Mobile: +91 976-788-8246* --000000000000b65b5605a32d4611 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, patch applied.

On Mon, Apr 13, 2020 at 2:29 PM Khus= hboo Vashi <khushboo.= vashi@enterprisedb.com> wrote:
Hi,

Please find t= he attached patch to fix the test cases due to this patch.
Also, = this functionality will not be applicable on EPAS server as we can change t= he view definition without dropping it.

Thanks,
Khushboo

On Wed, Apr 8, 2020 at 11:42 AM Akshay Joshi <akshay.joshi= @enterprisedb.com> wrote:
Thanks, patch applied.=C2=A0
On Wed, A= pr 8, 2020 at 10:58 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com>= wrote:
Hi Akshay,

Please find the attached updated pat= ch.

Thanks,
Khushboo

On Tue, Apr 7,= 2020 at 11:43 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
=
Hi= =C2=A0Khushboo

The warning message is not showing=C2=A0u= p. Please fix and resend the patch.

On Tue, Apr 7, 2020 at 10:00 AM Kh= ushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Akshay,=

Please find the attached updated patch.

=
On Tue, Ma= r 24, 2020 at 2:47 PM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:=
Hi=C2=A0Khushboo

On Tue, Mar 24, 2020 at 1:47 PM Khushboo= Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Ak= shay,

On Tue, Jan 14, 2020 at 11:47 AM Akshay Joshi <akshay.joshi@enterprisedb.co= m> wrote:
Hi=C2=A0Khushboo

Following are the rev= iew comments:
  • Fix the PEP8 issue.
  • Drop query shou= ld be part of the jinja template for consistency. Currently, it is added th= rough the python file.
The Delete qu= ery is already in the template file, I have just reused the delete call and= merged the SQL queries in the python file.=C2=A0
  • Any changes in = the view code should not warn the user "Changing the columns in a view= requires dropping...." and we should not drop the view. For example, = I have only change the WHERE clause or added 'ORDER BY'.=C2=A0
  • =
I have tested but=C2=A0 couldn't rep= roduce this issue.=C2=A0 Can you please let me know the proper use case?

=C2=A0 =C2=A0Create a view = with 'SELECT 1;' as code. Then change the code to 'SELECT 1234;= ' and click on the Save button.=C2=A0
=C2=A0 =C2=A0Warning po= pup is displayed "Changing the columns in a view....". Click on t= he 'Yes' button and check the OID of the view. You will get the sam= e OID, it means view is not recreated.
=C2=A0 =C2=A0=C2=A0
<= /div>
I can reproduce this issue with the given SQL = but the problem is as per the PostgreSQL documentation, (Ref:=C2=A0https://www.postgresql.org/docs/12/sql-createview.html)

=
&qu= ot;CREATE OR REPLACE VIEW=C2=A0is similar, but if a view of the = same name already exists, it is replaced. The new query must generate the s= ame columns that were generated by the existing view query (that is, the sa= me column names in the same order and with the same data types), but it may= add additional columns to the end of the list. The calculations giving ris= e to the output columns may be completely different."

So, I put a check on the columns and if the column is chang= ed, the message will popup.

In case of the example= given by you, the column name is not changed as if you don't give the = column name it will be default and I think view would have the column names= properly.
=C2=A0
=C2=A0 =C2=A0 = I have observed below error in the browser while changing the code:=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 view.js:241 Uncaught Typ= eError: Cannot read property 'replace' of undefined
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 at child.onChange (view.js:241)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 at HTMLDivElement.dispatch (jquery.j= s:5237)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 at HTMLDivElement.elem= Data.handle (jquery.js:5044)

Fixed.=C2=A0

Thanks,
Khushboo

Thanks,
Khushboo
=C2=A0

On Tue, Jan 14, 2020 at 10:27 AM Khushboo Vashi <khushboo.vashi@enterprisedb.= com> wrote:
Hi,

Please find the attached patch f= or RM #5053 -=C2=A0Getting an error while changing the columns in the exist= ing view.

PostgreSQL doesn't allow to change t= he view columns. So, while performing this task the existing view should be= dropped first and then recreate it and also user will get a warning first.=

Thanks,
Khushboo


--
Thanks & Regards
Akshay Joshi
<= font color=3D"#3333FF">Sr. Software Architect=
<= font color=3D"#000000" face=3D"arial, sans-serif">EnterpriseDB Software = India Private Limited
Mobile: +91 976-788-8246=


--
Thanks & Regards
Akshay Joshi
<= font color=3D"#3333FF">Sr. Software Architect=
<= font color=3D"#000000" face=3D"arial, sans-serif">EnterpriseDB Software = India Private Limited
Mobile: +91 976-788-8246=


--
Thanks & Regards
Akshay Joshi
<= font color=3D"#3333FF">Sr. Software Architect=
<= font color=3D"#000000" face=3D"arial, sans-serif">EnterpriseDB Software = India Private Limited
Mobile: +91 976-788-8246=


--
Thanks & Regards
Akshay Joshi
<= font color=3D"#3333FF">Sr. Software Architect=
<= font color=3D"#000000" face=3D"arial, sans-serif">EnterpriseDB Software = India Private Limited
Mobile: +91 976-788-8246=


--
Thanks & Regards
=
Akshay Joshi
Sr. Software Architect
EnterpriseDB Software India Private Limited
=
Mobile: += 91 976-788-8246
--000000000000b65b5605a32d4611--