Re: [pgAdmin4][Patch]: Fix RM1790 - [Web] Support setting a field's value to "null"

From: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: Fix RM1790 - [Web] Support setting a field's value to "null"
Date: 2017-02-03 07:28:59
Message-ID: CAM5-9D-XrhfhzhGZU0qqHbwxBqhVU9qtAgQWnpM2noTRVKZZSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Dave,

On Mon, Jan 30, 2017 at 6:18 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> On Fri, Jan 27, 2017 at 10:32 AM, Surinder Kumar
> <surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
> > Hi Dave,
> >
> > Please find updated patch.
> >
> > On Mon, Jan 16, 2017 at 10:01 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
> >>
> >> Hi
> >>
> >> On Fri, Jan 13, 2017 at 9:24 AM, Surinder Kumar
> >> <surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
> >> > Hi
> >> >
> >> > Please find attached patch and review.
> >> >
> >> > On Sun, Jan 8, 2017 at 3:27 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
> >> >>
> >> >> Hi
> >> >>
> >> >> On Friday, December 23, 2016, Surinder Kumar
> >> >> <surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
> >> >>>
> >> >>> Forgot to attach patch in last thread. please find patch.
> >> >>
> >> >>
> >> >> It looks good for the most part, except:
> >> >>
> >> >> 1) You missed the part we discussed about being able to set a value
> to
> >> >> ''
> >> >> (the literal string containing two single quotes) by entering \'\'
> (and
> >> >> of
> >> >> course, the follow-on cases to allow setting a value to \'\' by
> >> >> entering
> >> >> \\'\\' etc).
> >> >
> >> > Fixed.
> >>
> >> That doesn't seem right to me - the code you've written looks like
> >> it'll try to escape anything for use in a string literal, not just
> >> '\'\ or \\'\\' etc.
> >
> > Now the implementation is that It will find and unescape the string
> literals
> > like '\'\ or \\'\\' etc.
>
> I ran some tests:
>
> - Setting a field to '' resulted in the following SQL:
>
> UPDATE public.emp SET
> job = '''''' WHERE
> empno = 7369;
>
> - Setting a field to \"\" resulted in the following SQL:
>
> UPDATE public.emp SET
> job = '""' WHERE
> empno = 7499;
>
> - Setting a field to \'\' displayed \'\' in the grid until refreshed
> when the value vanished. The SQL it ran was:
>
​In current behaviour, we are saving the value provided by user and we are
not refreshing the grid with new values.
​Should we do refresh along with save?

>
> UPDATE public.emp SET
> job = '''''' WHERE
> empno = 7499;
>
> To be clear, here's what I'm expecting:
>
> Input: <empty>
> Display: [null]
> SQL: UPDATE t SET c = NULL WHERE k = <val>
>
> Input: ''
> Display:
> SQL: UPDATE t SET c = '' WHERE k = <val>
>
> Input: \'\'
> Display: ''
> SQL: UPDATE t SET c = '''''' WHERE k = <val>
>
> Input: \\'\\'
> Display: \'\'
> SQL: UPDATE t SET c = '\''\''' WHERE k = <val>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2017-02-03 07:38:19 Re: [pgAdmin4][Patch]: RM 2069 - Wrong tablespace displayed in table properties
Previous Message Khushboo Vashi 2017-02-03 06:44:50 Re: [pgAdmin4][Patch]: RM 2069 - Wrong tablespace displayed in table properties