X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D561D87A2 for ; Thu, 20 Oct 2005 03:57:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19324-02 for ; Thu, 20 Oct 2005 06:57:20 +0000 (GMT) Received: from smtp108.sbc.mail.mud.yahoo.com (smtp108.sbc.mail.mud.yahoo.com [68.142.198.207]) by svr1.postgresql.org (Postfix) with SMTP id 53A75DA6B2 for ; Thu, 20 Oct 2005 03:57:19 -0300 (ADT) Received: (qmail 61855 invoked from network); 20 Oct 2005 06:57:21 -0000 Received: from unknown (HELO obviously.com) (bryce?nesbitt@69.107.126.148 with plain) by smtp108.sbc.mail.mud.yahoo.com with SMTP; 20 Oct 2005 06:57:20 -0000 Message-ID: <43573FCE.7070301@obviously.com> Date: Wed, 19 Oct 2005 23:57:18 -0700 From: "Bryce Nesbitt (mailing list account)" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, es, en, de, he MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: casting character varying to integer - order by numeric References: <4356EC5D.4080706@obviously.com> <3687.1129779194@sss.pgh.pa.us> In-Reply-To: <3687.1129779194@sss.pgh.pa.us> Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.34 required=5 tests=[FORGED_RCVD_HELO=0.05, HTML_40_50=0.086, HTML_MESSAGE=0.001, HTML_TITLE_EMPTY=0.045, MIME_HTML_ONLY=1.158] X-Spam-Level: * X-Archive-Number: 200510/232 X-Sequence-Number: 23085 Tom Lane wrote:
But postgres 7 rejects this with "ERROR:  cannot cast type character 
varying to integer".
    

As a general rule, you need to be more specific than that about which
version you are working with ;-)

You may find that username::text::integer will work, depending on which
7.x this actually is.

			regards, tom lane
  
Oooh, I'd be so happy to.  But I don't know.  Yes, I don't know.

I know which version of "psql" is installed on my local machine, but the actual database is remote.  Is there a  command to get the server version?  As close as I can find is:

stage=> \copyright
PostgreSQL Data Base Management System

Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group


             -Bryce

PS: If it's a hint, "select username from eg_member order by username::text::integer" works fine.  Thanks.