Re: casting character varying to integer - order by numeric

From: "Bryce Nesbitt (mailing list account)" <bryce1(at)obviously(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: casting character varying to integer - order by numeric
Date: 2005-10-20 06:57:18
Message-ID: 43573FCE.7070301@obviously.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Tom Lane wrote:<br>
<blockquote cite="mid3687(dot)1129779194(at)sss(dot)pgh(dot)pa(dot)us" type="cite">
<blockquote type="cite">
<pre wrap="">But postgres 7 rejects this with "ERROR: cannot cast type character
varying to integer".
</pre>
</blockquote>
<pre wrap=""><!---->
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
</pre>
</blockquote>
Oooh, I'd be so happy to.&nbsp; But I don't know.&nbsp; Yes, I don't know.<br>
<br>
I know which version of "psql" is installed on my local machine, but
the actual database is remote.&nbsp; Is there a&nbsp; command to get the server
version?&nbsp; As close as I can find is:<br>
<br>
stage=&gt; \copyright<br>
PostgreSQL Data Base Management System<br>
<br>
Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; -Bryce<br>
<br>
PS: If it's a hint, "select username from eg_member order by
username::text::integer" works fine.&nbsp; Thanks.<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.3 KB

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-10-20 07:32:58 Re: casting character varying to integer - order by numeric
Previous Message tobbe 2005-10-20 06:36:24 automatic update or insert