Comment 2 for bug 139550

Revision history for this message
Björn Tillenius (bjornt) wrote : Re: [Bug 139550] Re: sync-source.py broke: column "published" does not exist

On Fri, Sep 14, 2007 at 08:10:01AM -0000, Julian Edwards wrote:
> "sbpph.status" = Published
>
> For some reason this query:
> query = """
> SELECT bpn.name, bpr.version, c.name
> FROM binarypackagerelease bpr, binarypackagename bpn, component c,
> securebinarypackagepublishinghistory sbpph, distroarchrelease dar
> WHERE
> bpr.binarypackagename = bpn.id AND
> sbpph.binarypackagerelease = bpr.id AND
> sbpph.component = c.id AND
> sbpph.distroarchrelease = dar.id AND
> sbpph.status = %s AND dar.id in (%s)
> """ % (dbschema.PackagePublishingStatus.PUBLISHED, dar_ids)
>
> is generating the dbschema's *title* instead of its enum value.

That's because you simply convert the PUBLISHED enum item to a string.
You need to sql quote it, using sqlvalues() or quote(), if you're going
to use it in a SQL query.