public inbox for [email protected]  
help / color / mirror / Atom feed
From: Neel Patel <[email protected]>
To: Sebastian Albert <[email protected]>
Cc: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: pgAdmin3: check_option translated in View editing dialog
Date: Mon, 28 Dec 2015 16:13:41 +0530
Message-ID: <CACCA4P3ZAzSrht8O70NocLN6wCUeytGs-bB+CtnSz36zg5YdPw@mail.gmail.com> (raw)
In-Reply-To: <CACCA4P3dnzOun8wLd3swHQRQ_dJe31Bf6Wy9jD0fiKR1LmA9NA@mail.gmail.com>
References: <[email protected]>
	<CA+OCxoxCpLJYirHqRN15QVKNtULP2Nmvq4tudtoKKuLCvH7xHw@mail.gmail.com>
	<CACCA4P34muwjnknJ_fDmpNazYwsTq-9yzuucCXD-3C1Wr1ZgbA@mail.gmail.com>
	<CACCA4P3farSX1vsySWzBwJAJcoJbp97uz1pYNG=5iR_MBCtSPw@mail.gmail.com>
	<CA+OCxowpMOSnTqu8d+my1doAVyGSHC1cz1nrh2Yv5aSOthqggQ@mail.gmail.com>
	<[email protected]>
	<CACCA4P3dnzOun8wLd3swHQRQ_dJe31Bf6Wy9jD0fiKR1LmA9NA@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi Dave,

I have fixed the issue. Can you please review the attached patch file ? Let
me know for any comments.

@Sebastian - Can you please apply and test the attached patch file ? Let us
know for any issue.

Thanks,
Neel Patel

On Thu, Dec 24, 2015 at 5:44 PM, Neel Patel <[email protected]>
wrote:

> Hi Sebastian,
>
> Thank you for the information. Issue is reproduced with the given steps.
> I will submit the patch after the fix.
>
> Thanks,
> Neel Patel
>
> On Thu, Dec 24, 2015 at 5:28 PM, Sebastian Albert <
> [email protected]> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Hi Neel
>>
>> Thanks for looking into it. Dave is right, it's about the SQL
>> statement not working (because of translation appearing for a sort of
>> keyword) *unless* edited manually. You should not *have to* edit the
>> SQL manually, but due to the issue, you do, no matter what property of
>> the view you are trying to change.
>>
>> So, to reproduce:
>> 1. Create a view
>> 2. Set language of pgAdmin to German
>> 3. Try to change anything on the view, e.g., try to rename it, using
>> the properties dialog.
>>
>> Unless I edit the SQL statement, I am presented an SQL error, which
>> comes from the check_option setting being translated.
>>
>> Happy holidays
>> Sebastian
>>
>> On 24.12.2015 12:20, Dave Page wrote:
>> > On Thu, Dec 24, 2015 at 11:18 AM, Neel Patel
>> > <[email protected]> wrote:
>> >> Hi Sebastian,
>> >>
>> >> We have just tried to reproduce the issue but not able to
>> >> understand the issue from the description.
>> >>
>> >> We followed below steps.
>> >>
>> >> 1. Change the language to German. 2. Open the existing View's
>> >> properties and try to change "With check option". 3. Open SQL
>> >> tab - According to change in option, we are able to see and edit
>> >> the query.
>> >>
>> >> Let me know if anything missing in above steps or Can you please
>> >> give steps to understand the issue ?
>> >
>> > Hi Neel,
>> >
>> > I believe the issue is that "no" is being translated to "nein" in
>> > the SQL:
>> >
>> > ALTER VIEW myview SET (check_option=nein);
>> >
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v2
>>
>> iQIcBAEBCAAGBQJWe93qAAoJEKZN7hpT3kUKTrgP/1wmrrScAtfvNc269K9+t1sa
>> UKyBfyMFvSgcMgydLC6bjsV5ECN2EVeV/qtNy6tGIlpWppzTtXccQxbKvQiwkyT1
>> F3MHM6tp869kegB0N2ZU5mzE+8ko/PaFRAISQomSlpxpDsATZ+5nR3VnFnh5DMde
>> 4XYbPvdZWH4Kos9yrWDKTxi5FVHbCvj4m86Qxg8hMlOGUixRDlVx77t1dccchEjq
>> OJRenlQWO9x65iRQbobXJtJddyQLplulc7enBgSJapQahQ4QTqe4RTx7f4Qya2B8
>> 9bIndvgIvbI08cnss7BQ8iJvK737gMoHc9CscwEAwadaI69/2QAlB4wtwS5bwIZp
>> DIeW+ulNJC40ZX6Ol/QMNZEvm1pBdwncLAUJBaiHht6M9rJcXld99uEPJDfP5wji
>> 2M9WAa3fjyLJFV3d1lA2GYujPgUBAr7KCRcAxgQSXopCj8KICYJzCOkP5skHIPlL
>> zYEMDML3uATmMPbabhy65/mf44WgzjebnQwM86iwnPRbWzfzSrWyK26fm+9CZ6aF
>> kgZvS9bWtQDViS/+6vTMuR3YQK4H+iU88RCIDbrHa8Kn53S8ryglg1f2CKtqrV9z
>> 2bNlK+iCNFxHoz1ApDw0CE8cJTKU31fL/B17+gB/bL6cCtnpzyCjNosRtO7vr89b
>> 7N9Y5AOnyVwbQD42/3EN
>> =KwP3
>> -----END PGP SIGNATURE-----
>>
>
>


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] View_Fix.patch (3.0K, 3-View_Fix.patch)
  download | inline diff:
diff --git a/pgadmin/dlg/dlgView.cpp b/pgadmin/dlg/dlgView.cpp
index 4fb510a..9991c38 100644
--- a/pgadmin/dlg/dlgView.cpp
+++ b/pgadmin/dlg/dlgView.cpp
@@ -358,12 +358,7 @@ int dlgView::Go(bool modal)
 				DisableMaterializedView();
 			}
 
-			if (view->GetCheckOption().Cmp(wxT("cascaded")) == 0)
-				cbCheckOption->SetSelection(2);
-			else if (view->GetCheckOption().Cmp(wxT("local")) == 0)
-				cbCheckOption->SetSelection(1);
-			else
-				cbCheckOption->SetSelection(0);
+			cbCheckOption->SetSelection(GetIndexCheckOption(view->GetCheckOption()));
 		}
 	}
 	else
@@ -446,7 +441,7 @@ void dlgView::CheckChange()
 
 		if (connection->BackendMinimumVersion(9, 4) && view)
 		{
-			enable = enable || cbCheckOption->GetValue().Lower().Cmp(view->GetCheckOption()) != 0;
+			enable = enable || (cbCheckOption->GetSelection() != GetIndexCheckOption(view->GetCheckOption()));
 		}
 	}
 
@@ -526,7 +521,10 @@ wxString dlgView::GetSql()
 			{
 				if (withoptions.Length() > 0)
 					withoptions += wxT(", ");
-				withoptions += wxT("check_option=") + cbCheckOption->GetValue().Lower();
+				if (cbCheckOption->GetSelection() == 1)
+				    withoptions += wxT("check_option=local");
+				if (cbCheckOption->GetSelection() == 2)
+				    withoptions += wxT("check_option=cascaded");
 			}
 
 			if (withoptions.Length() > 0)
@@ -739,12 +737,17 @@ wxString dlgView::GetSql()
 			}
 
 			if (connection->BackendMinimumVersion(9, 4)
-			        && cbCheckOption->GetValue().Lower().Cmp(view->GetCheckOption()) != 0)
+			        && cbCheckOption->GetSelection() != GetIndexCheckOption(view->GetCheckOption()) )
 			{
-				if (cbCheckOption->GetValue().Cmp(wxT("No")) == 0)
+				if ((cbCheckOption->GetSelection()) == 0)
 					sql += wxT("ALTER VIEW ") + name + wxT(" RESET (check_option);\n");
 				else
-					sql += wxT("ALTER VIEW ") + name + wxT("\n  SET (check_option=") + cbCheckOption->GetValue().Lower() + wxT(");\n");
+				{
+					if (cbCheckOption->GetSelection() == 1)
+					    sql += wxT("ALTER VIEW ") + name + wxT("\n  SET (check_option=local") + wxT(");\n");
+					if (cbCheckOption->GetSelection() == 2)
+					    sql += wxT("ALTER VIEW ") + name + wxT("\n  SET (check_option=cascaded") + wxT(");\n");
+				}
 			}
 
 			if (withoptions.Length() > 0)
@@ -1218,3 +1221,13 @@ void dlgView::DisableStorageParameters()
 	txtToastFreezeMaxAge->Disable();
 	txtToastFreezeTableAge->Disable();
 }
+
+int dlgView::GetIndexCheckOption(const wxString &str) const
+{
+    if (str.Cmp(wxT("local")) == 0)
+	return 1;
+    if (str.Cmp(wxT("cascaded")) == 0)
+	return 2;
+
+    return 0;
+}
diff --git a/pgadmin/include/dlg/dlgView.h b/pgadmin/include/dlg/dlgView.h
index 50034fa..25a0c20 100644
--- a/pgadmin/include/dlg/dlgView.h
+++ b/pgadmin/include/dlg/dlgView.h
@@ -45,6 +45,7 @@ private:
 	wxString AppendNum(bool &changed, wxTextCtrl *ctl, wxString val);
 	void DisableMaterializedView();
 	void DisableStorageParameters();
+	int GetIndexCheckOption(const wxString &str) const;
 
 	pgSchema *schema;
 	pgView *view;


view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: pgAdmin3: check_option translated in View editing dialog
  In-Reply-To: <CACCA4P3ZAzSrht8O70NocLN6wCUeytGs-bB+CtnSz36zg5YdPw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox