public inbox for [email protected]
help / color / mirror / Atom feedFrom: Neel Patel <[email protected]>
To: Khushboo Vashi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: Unable to update Domain properly
Date: Wed, 13 Jan 2016 22:57:15 +0530
Message-ID: <CACCA4P095=s7tBwPTkgoHuhKndqMQxUfCX6bstiO01nym5JhPQ@mail.gmail.com> (raw)
In-Reply-To: <CAFOhELfE7Ne5-Z0+igjeKQHbYWhkB_3UxTSWB-evsu7pixVkUA@mail.gmail.com>
References: <CAFOhELfE7Ne5-Z0+igjeKQHbYWhkB_3UxTSWB-evsu7pixVkUA@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
Please find the attached patch file for fix of above issue.
*Issue:- *
Below generated SQL was wrong.
ALTER DOMAIN pem."TestDomain"
RENAME TO "TestDomain1";
ALTER DOMAIN pem."TestDomain"
DROP NOT NULL;
In second query, domain name is wrong as domain name was updated by the
first query.
*Resolution:-*
Now when any properties got changed along with domain name then correct SQL
will be generated.
Correct query should be as below.
ALTER DOMAIN pem."TestDomain"
RENAME TO "TestDomain1";
ALTER DOMAIN pem."TestDomain1"
DROP NOT NULL;
Please review it and do let us know for any comment.
Thanks,
Neel Patel
On Wed, Jan 13, 2016 at 6:43 PM, Khushboo Vashi <
[email protected]> wrote:
> Hi,
>
> While updating Domain from pgAdmin-III , I observed an error.
>
> When I update only Domain name it is working properly, but when I try to
> update multiple fields, I get an error.
>
> For example, if I try to rename Domain *TestDomain* to *TestDomain1* and
> also modifies one or more fields (except comment). I get below error.
>
>
> ERROR: type "pem.TestDomain" does not exist
>
> *Generated SQL:*
>
> ALTER DOMAIN pem."TestDomain"
> RENAME TO "TestDomain1";
> ALTER DOMAIN pem."TestDomain"
> DROP NOT NULL;
>
>
> Thanks,
> Khushboo
>
--
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] domain_fix.patch (1.5K, 3-domain_fix.patch)
download | inline diff:
diff --git a/pgadmin/dlg/dlgDomain.cpp b/pgadmin/dlg/dlgDomain.cpp
index a3992f2..073850c 100644
--- a/pgadmin/dlg/dlgDomain.cpp
+++ b/pgadmin/dlg/dlgDomain.cpp
@@ -292,7 +292,7 @@ wxString dlgDomain::GetSql()
}
if (chkNotNull->GetValue() != domain->GetNotNull())
{
- sql += wxT("ALTER DOMAIN ") + domain->GetQuotedFullIdentifier();
+ sql += wxT("ALTER DOMAIN ") + qtIdent(name);
if (chkNotNull->GetValue())
sql += wxT("\n SET NOT NULL;\n");
else
@@ -300,7 +300,7 @@ wxString dlgDomain::GetSql()
}
if (txtDefault->GetValue() != domain->GetDefault())
{
- sql += wxT("ALTER DOMAIN ") + domain->GetQuotedFullIdentifier();
+ sql += wxT("ALTER DOMAIN ") + qtIdent(name);
if (txtDefault->GetValue().IsEmpty())
sql += wxT("\n DROP DEFAULT;\n");
else
@@ -318,7 +318,7 @@ wxString dlgDomain::GetSql()
tmpDef.RemoveAt(index);
else
{
- tmpsql += wxT("ALTER DOMAIN ") + domain->GetQuotedFullIdentifier()
+ tmpsql += wxT("ALTER DOMAIN ") + qtIdent(name);
+ wxT("\n ADD");
if (!conname.IsEmpty())
tmpsql += wxT(" CONSTRAINT ");
@@ -335,9 +335,8 @@ wxString dlgDomain::GetSql()
definition = definition.Mid(1).BeforeFirst('"');
else
definition = definition.BeforeFirst(' ');
- sql += wxT("ALTER DOMAIN ") + domain->GetQuotedFullIdentifier()
+ sql += wxT("ALTER DOMAIN ") + qtIdent(name)
+ wxT("\n DROP CONSTRAINT ") + qtIdent(definition) + wxT(";\n");
-
}
// Add the ADD CONSTRAINTs...
view thread (3+ 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]
Subject: Re: Unable to update Domain properly
In-Reply-To: <CACCA4P095=s7tBwPTkgoHuhKndqMQxUfCX6bstiO01nym5JhPQ@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