Re: PATCH: Fail to restore table/function, if it has special characters.

Lists: pgadmin-hackers
From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-15 14:10:23
Message-ID: 8cf965d31003150710t7f0c6d65r353ee354d5abdd18@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

Hi Dave,

The restore option of a table/function will fail, if the function name
contains special characters (i.e. test"xyz)
Please find the patch to resolve the issue for both the trunk and
1_10_0_PATCHES branch.

--
Ashesh Vashi
EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>

Attachment Content-Type Size
FB12720_v1.patch application/octet-stream 4.5 KB
FB12720_REL_1_10_0_PATCHES_v1.patch application/octet-stream 3.6 KB

From: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-15 14:47:11
Message-ID: 937d27e11003150747r3f41ed2dm131abb35d86d4f79@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

On Mon, Mar 15, 2010 at 2:10 PM, Ashesh Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>
> Hi Dave,
> The restore option of a table/function will fail, if the function name
> contains special characters (i.e. test"xyz)
> Please find the patch to resolve the issue for both the trunk and
> 1_10_0_PATCHES branch.

Hi,

Why the refactoring? That's certainly not desired on the 1.10 branch,
and should be justified (and applied consistently in other related
dialogues) if we want to include it for 1.12.

/D

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PG East Conference: http://www.enterprisedb.com/community/nav-pg-east-2010.do


From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-16 09:38:00
Message-ID: 8cf965d31003160238x5e92e3f1k8b421464cb9db99b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

Please find the updated patches.

On Mon, Mar 15, 2010 at 8:17 PM, Dave Page <dave(dot)page(at)enterprisedb(dot)com>wrote:

> On Mon, Mar 15, 2010 at 2:10 PM, Ashesh Vashi
> <ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> >
> > Hi Dave,
> > The restore option of a table/function will fail, if the function name
> > contains special characters (i.e. test"xyz)
> > Please find the patch to resolve the issue for both the trunk and
> > 1_10_0_PATCHES branch.
>
> Hi,
>
> Why the refactoring? That's certainly not desired on the 1.10 branch,
> and should be justified (and applied consistently in other related
> dialogues) if we want to include it for 1.12.
>
> /D
>
> --
> Dave Page
> EnterpriseDB UK: http://www.enterprisedb.com
> PG East Conference:
> http://www.enterprisedb.com/community/nav-pg-east-2010.do
>

Attachment Content-Type Size
FB12720_REL_1_10_0_PATCHES_v2.patch application/octet-stream 5.2 KB
FB12720_v2.patch application/octet-stream 5.1 KB

From: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-16 10:56:41
Message-ID: 937d27e11003160356k176a4f51qc28126ae3faa99e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

Thanks, applied.

On Tue, Mar 16, 2010 at 9:38 AM, Ashesh Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> Please find the updated patches.
>
>
> On Mon, Mar 15, 2010 at 8:17 PM, Dave Page <dave(dot)page(at)enterprisedb(dot)com>
> wrote:
>>
>> On Mon, Mar 15, 2010 at 2:10 PM, Ashesh Vashi
>> <ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>> >
>> > Hi Dave,
>> > The restore option of a table/function will fail, if the function name
>> > contains special characters (i.e. test"xyz)
>> > Please find the patch to resolve the issue for both the trunk and
>> > 1_10_0_PATCHES branch.
>>
>> Hi,
>>
>> Why the refactoring? That's certainly not desired on the 1.10 branch,
>> and should be justified (and applied consistently in other related
>> dialogues) if we want to include it for 1.12.
>>
>> /D
>>
>> --
>> Dave Page
>> EnterpriseDB UK: http://www.enterprisedb.com
>> PG East Conference:
>> http://www.enterprisedb.com/community/nav-pg-east-2010.do
>
>

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PG East Conference: http://www.enterprisedb.com/community/nav-pg-east-2010.do


From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-18 14:19:01
Message-ID: 8cf965d31003180719w1726bda2u4713cbe69b7a4894@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

Hi,

The bug was also there for the windows. :-(
I had to modify the commandLineCleanOption function to resolve the issue and
to make it platform-independent.

Please find the attached patch for the same.

I have made changes in the following files as described:
* include/utils/misc.h
- Changed the definition of the "commandLineCleanOption" function
* utils/misc.cpp
- Changed the "commandLineCleanOption" function to make it work on any
platform.
*/***
* * FUNCTION: commandLineCleanOption*
* * INPUTS:*
* * option - input string needs to be reformatted*
* * schemaObject - Is this an object related to schema?*
* * PURPOSE:*
* * - Fixup a (double-quoted) string for use on the command line*
* **
* * 1. Schema objects needs three (slash & double-quote) combination*
* * instead of a double-quote to be used as a command-line option*
* * 2. Options other than the schema objects needs (slash & double-quote)
*
* * combination instead of a double-quote to be used as a command-line
*
* * option.*
* **
* * i.e. CASE: Dump a table named em"p and database name tes"t having
username*
* * xy\z. The command-line arguments for these values will be as
below:*
* **
* * pg_dump --username "xy\\z" --table public."em\"\"\"p" "tes\"t"*
* */*
The above comments says everything about its implementation.
* frm/frmBackup.cpp
* frm/frmBackupGlobals.cpp
* frm/frmBackupServer.cpp
* frm/frmRestore.cpp

Dave,

In order the solve this issue on 1_10_PATCHES branch, we may need to do the
similar refactoring.
Is it ok?
If yes, I can share the patch for the same.

--

Ashesh Vashi
EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>

Attachment Content-Type Size
FB14805_v2.patch application/octet-stream 8.4 KB

From: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-18 14:32:29
Message-ID: 937d27e11003180732k3b856525u90c11d21de793716@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

On Thu, Mar 18, 2010 at 2:19 PM, Ashesh Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> Hi,
> The bug was also there for the windows. :-(
> I had to modify the commandLineCleanOption function to resolve the issue and
> to make it platform-independent.
>
> Please find the attached patch for the same.
> I have made changes in the following files as described:
> * include/utils/misc.h
> - Changed the definition of the "commandLineCleanOption" function
> * utils/misc.cpp
> - Changed the "commandLineCleanOption" function to make it work on any
> platform.
> /**
>  * FUNCTION: commandLineCleanOption
>  * INPUTS:
>  *       option       - input string needs to be reformatted
>  *       schemaObject - Is this an object related to schema?
>  * PURPOSE:
>  *  - Fixup a (double-quoted) string for use on the command line
>  *
>  *    1. Schema objects needs three (slash & double-quote) combination
>  *       instead of a double-quote to be used as a command-line option
>  *    2. Options other than the schema objects needs (slash & double-quote)
>  *       combination instead of a double-quote to be used as a command-line
>  *       option.
>  *
>  *    i.e. CASE: Dump a table named em"p and database name tes"t having
> username
>  *         xy\z. The command-line arguments for these values will be as
> below:
>  *
>  *         pg_dump --username "xy\\z" --table public."em\"\"\"p" "tes\"t"
>  */
> The above comments says everything about its implementation.
> * frm/frmBackup.cpp
> * frm/frmBackupGlobals.cpp
> * frm/frmBackupServer.cpp
> * frm/frmRestore.cpp
> Dave,
> In order the solve this issue on 1_10_PATCHES branch, we may need to do the
> similar refactoring.
> Is it ok?
> If yes, I can share the patch for the same.

Please do.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PG East Conference: http://www.enterprisedb.com/community/nav-pg-east-2010.do


From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dave(dot)page(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-19 06:10:54
Message-ID: 8cf965d31003182310r254ba7d4r3d00ecb1b6f5173f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

Please find the attached patch for REL_1_10_PATCHES branches and updated
patch for the trunk (with few tab characters to 4 spaces.)

--

Ashesh Vashi
EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>

On Thu, Mar 18, 2010 at 8:02 PM, Dave Page <dave(dot)page(at)enterprisedb(dot)com>wrote:

> On Thu, Mar 18, 2010 at 2:19 PM, Ashesh Vashi
> <ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> > Hi,
> > The bug was also there for the windows. :-(
> > I had to modify the commandLineCleanOption function to resolve the issue
> and
> > to make it platform-independent.
> >
> > Please find the attached patch for the same.
> > I have made changes in the following files as described:
> > * include/utils/misc.h
> > - Changed the definition of the "commandLineCleanOption" function
> > * utils/misc.cpp
> > - Changed the "commandLineCleanOption" function to make it work on any
> > platform.
> > /**
> > * FUNCTION: commandLineCleanOption
> > * INPUTS:
> > * option - input string needs to be reformatted
> > * schemaObject - Is this an object related to schema?
> > * PURPOSE:
> > * - Fixup a (double-quoted) string for use on the command line
> > *
> > * 1. Schema objects needs three (slash & double-quote) combination
> > * instead of a double-quote to be used as a command-line option
> > * 2. Options other than the schema objects needs (slash &
> double-quote)
> > * combination instead of a double-quote to be used as a
> command-line
> > * option.
> > *
> > * i.e. CASE: Dump a table named em"p and database name tes"t having
> > username
> > * xy\z. The command-line arguments for these values will be as
> > below:
> > *
> > * pg_dump --username "xy\\z" --table public."em\"\"\"p" "tes\"t"
> > */
> > The above comments says everything about its implementation.
> > * frm/frmBackup.cpp
> > * frm/frmBackupGlobals.cpp
> > * frm/frmBackupServer.cpp
> > * frm/frmRestore.cpp
> > Dave,
> > In order the solve this issue on 1_10_PATCHES branch, we may need to do
> the
> > similar refactoring.
> > Is it ok?
> > If yes, I can share the patch for the same.
>
> Please do.
>
>
> --
> Dave Page
> EnterpriseDB UK: http://www.enterprisedb.com
> PG East Conference:
> http://www.enterprisedb.com/community/nav-pg-east-2010.do
>

Attachment Content-Type Size
FB14805_1_10_PATCHES_v3.patch application/octet-stream 8.3 KB
FB14805_v3.patch application/octet-stream 8.4 KB

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-19 09:51:41
Message-ID: 937d27e11003190251j256ff48aycf46933201ebae1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

On Fri, Mar 19, 2010 at 6:10 AM, Ashesh Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
>
> Please find the attached patch for REL_1_10_PATCHES branches and updated
> patch for the trunk (with few tab characters to 4 spaces.)

I'd be surprised if this works - past experience of fixing this stuff
in similar areas tells me that using the same quoting rules on Windows
and *nix are quite different.

What platforms did you test on?

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PG East Conference: http://www.enterprisedb.com/community/nav-pg-east-2010.do


From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-19 09:56:23
Message-ID: 8cf965d31003190256g3dd1cad4mb79422a85a50f7d2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

I tested on Windows XP SP2, Ubuntu 9.10 32 bit & Mac OSX 10.5 Intel.

On Fri, Mar 19, 2010 at 3:21 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> On Fri, Mar 19, 2010 at 6:10 AM, Ashesh Vashi
> <ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> >
> > Please find the attached patch for REL_1_10_PATCHES branches and updated
> > patch for the trunk (with few tab characters to 4 spaces.)
>
> I'd be surprised if this works - past experience of fixing this stuff
> in similar areas tells me that using the same quoting rules on Windows
> and *nix are quite different.
>
> What platforms did you test on?
>
> --
> Dave Page
> EnterpriseDB UK: http://www.enterprisedb.com
> PG East Conference:
> http://www.enterprisedb.com/community/nav-pg-east-2010.do
>


From: Dave Page <dpage(at)pgadmin(dot)org>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Fail to restore table/function, if it has special characters.
Date: 2010-03-19 10:31:54
Message-ID: 937d27e11003190331u286d50c0ibc509026e982bd03@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgadmin-hackers

On Fri, Mar 19, 2010 at 9:56 AM, Ashesh Vashi
<ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> I tested on Windows XP SP2, Ubuntu 9.10 32 bit & Mac OSX 10.5 Intel.

Hmm, well it works for me too, so I'll eat my words and congratulate
you on finding a nice clean solution :-)

Thanks - applied.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PG East Conference: http://www.enterprisedb.com/community/nav-pg-east-2010.do