Обсуждение: Weird code in pgDomain.cpp

Поиск
Список
Период
Сортировка

Weird code in pgDomain.cpp

От
Guillaume Lelarge
Дата:
Hi,

I was trying to fix a bug on dlgDomain, and I found this code (in
pgadmin/schema/pgDomain.cpp):

wxString conname = set->GetVal(wxT("conname"));
if (!conname.StartsWith(wxT("$")))
    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");

I'm wondering why we look for a dollar sign in the first character of a
check constraint in a domain. It means nothing to me. Could it be some
GreenPlum or EnterpriseDB specific code? or is it something else?

I'm also wondering if we could drop this code. Doesn't seem to do much,
and doesn't help us with modifying a check constraint in a domain.

Thanks.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com


Re: Weird code in pgDomain.cpp

От
Dave Page
Дата:
On Sun, Apr 8, 2012 at 4:44 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> Hi,
>
> I was trying to fix a bug on dlgDomain, and I found this code (in
> pgadmin/schema/pgDomain.cpp):
>
> wxString conname = set->GetVal(wxT("conname"));
> if (!conname.StartsWith(wxT("$")))
>    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");
>
> I'm wondering why we look for a dollar sign in the first character of a
> check constraint in a domain. It means nothing to me. Could it be some
> GreenPlum or EnterpriseDB specific code? or is it something else?

Not that I recall - Ashesh, Sachin - do you know if it's a PPAS thing?

>
> I'm also wondering if we could drop this code. Doesn't seem to do much,
> and doesn't help us with modifying a check constraint in a domain.

Dunno.


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Weird code in pgDomain.cpp

От
Ashesh Vashi
Дата:
On Sun, Apr 8, 2012 at 3:24 PM, Dave Page <dpage@pgadmin.org> wrote:
On Sun, Apr 8, 2012 at 4:44 AM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> Hi,
>
> I was trying to fix a bug on dlgDomain, and I found this code (in
> pgadmin/schema/pgDomain.cpp):
>
> wxString conname = set->GetVal(wxT("conname"));
> if (!conname.StartsWith(wxT("$")))
>    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");
>
> I'm wondering why we look for a dollar sign in the first character of a
> check constraint in a domain. It means nothing to me. Could it be some
> GreenPlum or EnterpriseDB specific code? or is it something else?

Not that I recall - Ashesh, Sachin - do you know if it's a PPAS thing?
Not that I recall.

It's been there from very long time..
i.e. git log 6003c502d89900b2b2e1538d340db028b1880aa1 -p -n 1 schema/pgDomain.cpp

--
Ashesh Vashi

>
> I'm also wondering if we could drop this code. Doesn't seem to do much,
> and doesn't help us with modifying a check constraint in a domain.

Dunno.


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Weird code in pgDomain.cpp

От
Guillaume Lelarge
Дата:
On Mon, 2012-04-09 at 19:58 +0530, Ashesh Vashi wrote:
> On Sun, Apr 8, 2012 at 3:24 PM, Dave Page <dpage@pgadmin.org> wrote:
>
> > On Sun, Apr 8, 2012 at 4:44 AM, Guillaume Lelarge
> > <guillaume@lelarge.info> wrote:
> > > Hi,
> > >
> > > I was trying to fix a bug on dlgDomain, and I found this code (in
> > > pgadmin/schema/pgDomain.cpp):
> > >
> > > wxString conname = set->GetVal(wxT("conname"));
> > > if (!conname.StartsWith(wxT("$")))
> > >    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");
> > >
> > > I'm wondering why we look for a dollar sign in the first character of a
> > > check constraint in a domain. It means nothing to me. Could it be some
> > > GreenPlum or EnterpriseDB specific code? or is it something else?
> >
> > Not that I recall - Ashesh, Sachin - do you know if it's a PPAS thing?
> >
> Not that I recall.
>
> It's been there from very long time..
> i.e. git log 6003c502d89900b2b2e1538d340db028b1880aa1 -p -n 1
> schema/pgDomain.cpp
>

OK. I got rid of it, but I'm still working on enhancing the domains
code. I now have a Constraints node under each domain object, and a new
tab in dlgDomain to add as many constraints as you want (only check
constraints of course). See screenshots attached.

I still need to test it more thoroughly.


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

Вложения

Re: Weird code in pgDomain.cpp

От
Dave Page
Дата:
On Tue, Apr 10, 2012 at 9:17 PM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> On Mon, 2012-04-09 at 19:58 +0530, Ashesh Vashi wrote:
>> On Sun, Apr 8, 2012 at 3:24 PM, Dave Page <dpage@pgadmin.org> wrote:
>>
>> > On Sun, Apr 8, 2012 at 4:44 AM, Guillaume Lelarge
>> > <guillaume@lelarge.info> wrote:
>> > > Hi,
>> > >
>> > > I was trying to fix a bug on dlgDomain, and I found this code (in
>> > > pgadmin/schema/pgDomain.cpp):
>> > >
>> > > wxString conname = set->GetVal(wxT("conname"));
>> > > if (!conname.StartsWith(wxT("$")))
>> > >    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");
>> > >
>> > > I'm wondering why we look for a dollar sign in the first character of a
>> > > check constraint in a domain. It means nothing to me. Could it be some
>> > > GreenPlum or EnterpriseDB specific code? or is it something else?
>> >
>> > Not that I recall - Ashesh, Sachin - do you know if it's a PPAS thing?
>> >
>> Not that I recall.
>>
>> It's been there from very long time..
>> i.e. git log 6003c502d89900b2b2e1538d340db028b1880aa1 -p -n 1
>> schema/pgDomain.cpp
>>
>
> OK. I got rid of it, but I'm still working on enhancing the domains
> code. I now have a Constraints node under each domain object, and a new
> tab in dlgDomain to add as many constraints as you want (only check
> constraints of course). See screenshots attached.
>
> I still need to test it more thoroughly.

Nice!

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Weird code in pgDomain.cpp

От
Guillaume Lelarge
Дата:
On Wed, 2012-04-11 at 08:11 +0000, Dave Page wrote:
> On Tue, Apr 10, 2012 at 9:17 PM, Guillaume Lelarge
> <guillaume@lelarge.info> wrote:
> > On Mon, 2012-04-09 at 19:58 +0530, Ashesh Vashi wrote:
> >> On Sun, Apr 8, 2012 at 3:24 PM, Dave Page <dpage@pgadmin.org> wrote:
> >>
> >> > On Sun, Apr 8, 2012 at 4:44 AM, Guillaume Lelarge
> >> > <guillaume@lelarge.info> wrote:
> >> > > Hi,
> >> > >
> >> > > I was trying to fix a bug on dlgDomain, and I found this code (in
> >> > > pgadmin/schema/pgDomain.cpp):
> >> > >
> >> > > wxString conname = set->GetVal(wxT("conname"));
> >> > > if (!conname.StartsWith(wxT("$")))
> >> > >    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");
> >> > >
> >> > > I'm wondering why we look for a dollar sign in the first character of a
> >> > > check constraint in a domain. It means nothing to me. Could it be some
> >> > > GreenPlum or EnterpriseDB specific code? or is it something else?
> >> >
> >> > Not that I recall - Ashesh, Sachin - do you know if it's a PPAS thing?
> >> >
> >> Not that I recall.
> >>
> >> It's been there from very long time..
> >> i.e. git log 6003c502d89900b2b2e1538d340db028b1880aa1 -p -n 1
> >> schema/pgDomain.cpp
> >>
> >
> > OK. I got rid of it, but I'm still working on enhancing the domains
> > code. I now have a Constraints node under each domain object, and a new
> > tab in dlgDomain to add as many constraints as you want (only check
> > constraints of course). See screenshots attached.
> >
> > I still need to test it more thoroughly.
>
> Nice!
>

Thanks. I continued the work on this patch. It's almost ready to be
commited. Unfortunately, I still have one issue. The contextual menu of
the Constraints node doesn't allow the user to add a new constraint
(check constraint for a domain, all kind of constraints for a table). I
can still add a constraint when I select the domain (or table), and
right click to get the contextual menu. See patch attached. Any ideas
why it behaves this way?

Once this is fixed, I may have the solution to fix the same issue on the
User Mappings node...


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

Re: Weird code in pgDomain.cpp

От
Guillaume Lelarge
Дата:
On Sat, 2012-04-21 at 15:39 +0200, Guillaume Lelarge wrote:
> On Wed, 2012-04-11 at 08:11 +0000, Dave Page wrote:
> > On Tue, Apr 10, 2012 at 9:17 PM, Guillaume Lelarge
> > <guillaume@lelarge.info> wrote:
> > > On Mon, 2012-04-09 at 19:58 +0530, Ashesh Vashi wrote:
> > >> On Sun, Apr 8, 2012 at 3:24 PM, Dave Page <dpage@pgadmin.org> wrote:
> > >>
> > >> > On Sun, Apr 8, 2012 at 4:44 AM, Guillaume Lelarge
> > >> > <guillaume@lelarge.info> wrote:
> > >> > > Hi,
> > >> > >
> > >> > > I was trying to fix a bug on dlgDomain, and I found this code (in
> > >> > > pgadmin/schema/pgDomain.cpp):
> > >> > >
> > >> > > wxString conname = set->GetVal(wxT("conname"));
> > >> > > if (!conname.StartsWith(wxT("$")))
> > >> > >    check += wxT("CONSTRAINT ") + qtIdent(conname) + wxT(" ");
> > >> > >
> > >> > > I'm wondering why we look for a dollar sign in the first character of a
> > >> > > check constraint in a domain. It means nothing to me. Could it be some
> > >> > > GreenPlum or EnterpriseDB specific code? or is it something else?
> > >> >
> > >> > Not that I recall - Ashesh, Sachin - do you know if it's a PPAS thing?
> > >> >
> > >> Not that I recall.
> > >>
> > >> It's been there from very long time..
> > >> i.e. git log 6003c502d89900b2b2e1538d340db028b1880aa1 -p -n 1
> > >> schema/pgDomain.cpp
> > >>
> > >
> > > OK. I got rid of it, but I'm still working on enhancing the domains
> > > code. I now have a Constraints node under each domain object, and a new
> > > tab in dlgDomain to add as many constraints as you want (only check
> > > constraints of course). See screenshots attached.
> > >
> > > I still need to test it more thoroughly.
> >
> > Nice!
> >
>
> Thanks. I continued the work on this patch. It's almost ready to be
> commited. Unfortunately, I still have one issue. The contextual menu of
> the Constraints node doesn't allow the user to add a new constraint
> (check constraint for a domain, all kind of constraints for a table). I
> can still add a constraint when I select the domain (or table), and
> right click to get the contextual menu. See patch attached. Any ideas
> why it behaves this way?
>

OK, found the issue. Much easier to find a bug when using gdb (and
knowing how to use it).


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com