Re: Cast Problem - varchar() problem

From: <operationsengineer1(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Cast Problem - varchar() problem
Date: 2005-08-11 21:16:52
Message-ID: 20050811211652.73693.qmail@web33312.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

my apologies again. datatype was text in 7.4 and
varchar in 7.3... the database likely isn't the
cause, rather, my different datatypes is probably the
problem.

thanks for the help.

--- operationsengineer1(at)yahoo(dot)com wrote:

> --- Michael Fuhr <mike(at)fuhr(dot)org> wrote:
>
> > On Thu, Aug 11, 2005 at 11:50:02AM -0700,
> > operationsengineer1(at)yahoo(dot)com wrote:
> > > i do a sort by serial number. in order to sort
> > the
> > > way i want, i need to cast serial_number (type
> > text)
> > > as an integer.
> > >
> > > ... ORDER By serial_number::integer ASC;
> > >
> > > this works great in pgsql 7.4.x (whatever i'm
> > using on
> > > my dev box, i think 7.4.3, but not sure), but it
> > > doesn't work in pgsql 7.3.9.
> > >
> > > it doesn't allow the query to complete and i
> > > eventually get a "non object" error.
> >
> > What's the *exact* error message? I don't see
> "non
> > object" anywhere
> > in the 7.3 source code. What client interface are
> > you using?
> >
> > The following example works for me in 7.3.10, and
> I
> > don't see
> > anything in the Release Notes that suggests the
> > behavior has changed
> > since 7.3.9:
> >
> > CREATE TABLE foo (serial_number text);
> > INSERT INTO foo VALUES (1);
> > INSERT INTO foo VALUES (2);
> > INSERT INTO foo VALUES (3);
> > INSERT INTO foo VALUES (10);
> > INSERT INTO foo VALUES (20);
> > INSERT INTO foo VALUES (30);
> >
> > SELECT * FROM foo ORDER BY serial_number::integer;
> > serial_number
> > ---------------
> > 1
> > 2
> > 3
> > 10
> > 20
> > 30
> > (6 rows)
> >
> > Maybe this example is too simple to show the
> > problem. Could you
> > post a complete test case?
> >
> > --
> > Michael Fuhr
> >
>
> my apologies, i thought serial number was type text,
> but it is type varchar(). i will change it to text
> and see what happens.
>
> this is the error...
>
> Warning: pg_exec(): Query failed: ERROR: Cannot cast
> type character varying to integer in
> /home/home/adodb/drivers/adodb-postgres64.inc.php on
> line 741
> -1: ERROR: Cannot cast type character varying to
> integer
>
> it there is no error in 7.4.
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
>


____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-08-11 21:30:57 Re: Cast Problem
Previous Message operationsengineer1 2005-08-11 21:14:03 Re: Cast Problem