Обсуждение: Unable to create new function if "Owner" or "Comment" is specified.
Hi,
Due to re-quoting of already quoted schema qualified function name in the "ALTER FUNCTION <function name> OWNER to <owner name>" query while adding a new function we get an error about function name not found.
Attached is a patch that fixes the issue.
Regards,
Sachin Srivastava
EnterpriseDB, India
Вложения
Hi On Tue, Sep 4, 2012 at 6:14 PM, Sachin Srivastava <sachin.srivastava@enterprisedb.com> wrote: > > Hi, > > Due to re-quoting of already quoted schema qualified function name in the > "ALTER FUNCTION <function name> OWNER to <owner name>" query while adding a > new function we get an error about function name not found. > > Attached is a patch that fixes the issue. Thanks - unfortunately that's still not right, as it duplicates the schema name when creating new functions. I've applied the patch below which seems to work in both the create and edit cases: diff --git a/pgadmin/dlg/dlgFunction.cpp b/pgadmin/dlg/dlgFunction.cpp index d102b97..1d2cc1c 100644 --- a/pgadmin/dlg/dlgFunction.cpp +++ b/pgadmin/dlg/dlgFunction.cpp @@ -975,16 +975,19 @@ wxString dlgFunction::GetSql() } } - name = schema->GetQuotedPrefix() + qtIdent(name) - + wxT("(") + GetArgs(false, true) + wxT(")"); if (function) { + name = schema->GetQuotedPrefix() + qtIdent(name) + + wxT("(") + GetArgs(false, true) + wxT(")"); + AppendOwnerChange(sql, wxT("FUNCTION ") + name); AppendSchemaChange(sql, wxT("FUNCTION ") + name); } else { + name = name + wxT("(") + GetArgs(false, true) + wxT(")"); + if (cbOwner->GetCurrentSelection() > 0) AppendOwnerNew(sql, wxT("FUNCTION ") + name); } -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
On Wed, Sep 5, 2012 at 4:26 PM, Dave Page <dpage@pgadmin.org> wrote:
HiThanks - unfortunately that's still not right, as it duplicates the
On Tue, Sep 4, 2012 at 6:14 PM, Sachin Srivastava
<sachin.srivastava@enterprisedb.com> wrote:
>
> Hi,
>
> Due to re-quoting of already quoted schema qualified function name in the
> "ALTER FUNCTION <function name> OWNER to <owner name>" query while adding a
> new function we get an error about function name not found.
>
> Attached is a patch that fixes the issue.
schema name when creating new functions. I've applied the patch below
which seems to work in both the create and edit cases:
Strange.. I tried creating new functions only while testing my patch and it never duplicates the schema name.. I tested on Mac (10.6.8)..
Though your patch is making more sense.. (just by reading the code).
diff --git a/pgadmin/dlg/dlgFunction.cpp b/pgadmin/dlg/dlgFunction.cpp
index d102b97..1d2cc1c 100644
--- a/pgadmin/dlg/dlgFunction.cpp
+++ b/pgadmin/dlg/dlgFunction.cpp
@@ -975,16 +975,19 @@ wxString dlgFunction::GetSql()
}
}
- name = schema->GetQuotedPrefix() + qtIdent(name)
- + wxT("(") + GetArgs(false, true) + wxT(")");
if (function)
{
+ name = schema->GetQuotedPrefix() + qtIdent(name)
+ + wxT("(") + GetArgs(false, true) + wxT(")");
+
AppendOwnerChange(sql, wxT("FUNCTION ") + name);
AppendSchemaChange(sql, wxT("FUNCTION ") + name);
}
else
{
+ name = name + wxT("(") + GetArgs(false, true) + wxT(")");
+
if (cbOwner->GetCurrentSelection() > 0)
AppendOwnerNew(sql, wxT("FUNCTION ") + name);
}
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Regards,
Sachin Srivastava
EnterpriseDB, India