Skip site navigation (1) Skip section navigation (2)

xid cannot be casted to a different type

From: Edwin Groothuis <postgresql(at)mavetju(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: xid cannot be casted to a different type
Date: 2006-12-09 23:44:09
Message-ID: 20061209234409.GA75354@k7.mavetju (view raw or flat)
Thread:
Lists: pgsql-bugs
PostgreSQL version: 8.0 / 8.1 / 8.2
Operating System: FreeBSD
Short description: xid cannot be casted to a different type
Details:

    This statement is part of a longer one, which we used on 8.0
    to determine the status of the locks on the database:

    select relation,transaction::bigint,count(*) as waiting from
    pg_locks where not granted group by relation,transaction;

    This worked fine on 8.0.x. Now I'm preparing to move to 8.1
    and/or 8.2, but that above statement now gives me:

    ERROR:  could not identify an ordering operator for type xid
    HINT:  Use an explicit ordering operator or modify the query.

    According to a discussion on IRC with neilc and davidfetter:

    <neilc> davidfetter, Mavvie: we need an ordering operator to do GROUP BY
    <neilc> for some reason that's not clear to me atm
    <neilc> perhaps because originally we only implemented grouping / aggs via sorting?
    <davidfetter> neilc, makes sense, in a way
    <davidfetter> yeah
    <neilc> anyway, so the problem is just there aren't ordering operators for the xid type
    <Mavvie> neilc: I've tried to cast the transaction field (which is the xid) to a text, bigint or something else but it keeps coming back as "cannot cast type xid to ..."
    <neilc> there probably should be, like we added for tid i think in 8.2
    <davidfetter> would this be an initdb-forcing thing? :f
    <neilc> well, you could package the changes as sql
    <davidfetter> cool :)
    <neilc> i wouldn't personally bother backporting it tho, it's not a bug per se
    <davidfetter> hrm. i'd say anything that causes you not to be able to do "expected" operations like aggregation is a bug


-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin(at)mavetju(dot)org    |          Weblog: http://weblog.barnet.com.au/edwin/

pgsql-bugs by date

Next:From: Edwin GroothuisDate: 2006-12-10 01:13:32
Subject: BUG #2821: xid cannot be casted to a different type
Previous:From: trincheroDate: 2006-12-09 17:01:00
Subject: BUG #2820: "select" faling with "distinct" clause on a subquery

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group