On Tue, Feb 03, 2009 at 04:21:29PM +0530, Gurjeet Singh wrote:
> >
> > _query_latest_version = rhnSQL.Statement("""
> > SELECT nvl(version, 0) version, version orig_version, cert,
> > TO_CHAR(issued, 'YYYY-MM-DD HH24:MI:SS') issued,
> > TO_CHAR(expires, 'YYYY-MM-DD HH24:MI:SS') expires
> > FROM rhnSatelliteCert
> > WHERE label = :label
> > ORDER BY version DESC NULLS LAST
> > """)
> >
> > So rhnSatelliteCert needs some mappings, I think the TO_CHAR looks
> > usable in PostgreSQL, is it just the nvl that needs to change here?
> >
> > You can see quite a few other queries in the file, I don't know how
> > many of them are going to end up getting called but this is the first
> > one I hit.
>
> As Jan said, nvl() is provided by Orafce. But I'd recommend using ANSI
> standard COALESCE() for the purpose as that is available in both Oracle and
> Postgres.
>
> BTW, I am more worried about the NULLS LAST part of the query. As I have
> mentioned in the
> Worklog<https://fedorahosted.org/spacewalk/wiki/PostgresWorklog>,
> this feature is available in Postgres only since 8.3. And I have no freakin'
> clue how to get the same behaviour in PG < 8.3!
How about
order by decode(version, null, 1, 0), version
?
--
Jan Pazdziora
Satellite Engineering, Red Hat
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel