From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bryce W Nesbitt <bryce1@obviously.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: casting character varying to integer - order by numeric sort
Date: Wed, 19 Oct 2005 23:33:14 -0400
Message-ID: <3687.1129779194@sss.pgh.pa.us> (raw)
In-Reply-To: <4356EC5D.4080706@obviously.com>
References: <4356EC5D.4080706@obviously.com>
Bryce W Nesbitt <bryce1@obviously.com> writes:
> SELECT username,last_name
> FROM eg_member ORDER BY username::integer;
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, bryce1@obviously.com
Subject: Re: casting character varying to integer - order by numeric sort
In-Reply-To: <3687.1129779194@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox