Thread: CVS Commit by dpage: Prevent duplication of functional indexes

CVS Commit by dpage: Prevent duplication of functional indexes

From
cvs@cvs.pgadmin.org
Date:
Log Message:
-----------
Prevent duplication of functional indexes

Modified Files:
--------------
    pgadmin3/src/schema:
        pgIndex.cpp (r1.29 -> r1.30)


Attachment

Re: CVS Commit by dpage: Prevent duplication of

From
Andreas Pflug
Date:
cvs@cvs.pgadmin.org wrote:

>-        wxT(" ORDER BY cls.relname"));
>+        wxT(" ORDER BY cls.oid, cls.relname"));
>
>

Hi Dave,
did you find out what makes the result duplicate? Maybe the query is
written in a somehow unfortunate way, and could be properly rewritten?

The ORDER BY should probably read ORDER BY cls.relname, cls.oid to
remain alphabetical ordering.

Regards,
Andreas



Re: CVS Commit by dpage: Prevent duplication of functional indexes

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 04 May 2004 13:43
> To: Dave Page
> Cc: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] CVS Commit by dpage: Prevent
> duplication of functional indexes
>
> cvs@cvs.pgadmin.org wrote:
>
> >-        wxT(" ORDER BY cls.relname"));
> >+        wxT(" ORDER BY cls.oid, cls.relname"));
> >
> >
>
> Hi Dave,
> did you find out what makes the result duplicate? Maybe the
> query is written in a somehow unfortunate way, and could be
> properly rewritten?

It's caused by the additional pg_depend entry for the function used by
the index. I could see no easy way to get rid of it and no obvious
reason why a DISTINCT might cause problems in this case.

> The ORDER BY should probably read ORDER BY cls.relname,
> cls.oid to remain alphabetical ordering.

Hmm, good point. DISTINCT ON(cls.relname) should be OK as well I guess
(there should only ever be one index with a given name)....

Regards, Dave.