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

[Fwd: Re: converting number to string in query]

From: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
To: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: [Fwd: Re: converting number to string in query]
Date: 2009-07-08 08:18:38
Message-ID: 4A54565E.1090803@netzmeister-st-pauli.de (view raw or flat)
Thread:
Lists: pgsql-novice
Michael Wood schrieb:
> Hi
> 
> 2009/7/7 Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>:
> [...]
>> You have to typecast the integer 9:
>>
>> postgres=# SELECT id FROM test WHERE string = 9::text;
>>  id
>> ----
>> (0 rows)
> [...]
> 
> My understanding is that 9::text is PostgreSQL specific, and that
> cast(9 as text) would be more portable.  Is this correct?
> 
> See: http://www.postgresql.org/docs/current/static/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS
> 
yes that's correct - to be honest - I don't know if this short syntax is maybe also
supported in other DBMS but I don't think so ...

Cheers

Andy




pgsql-novice by date

Next:From: Ms swati chandeDate: 2009-07-08 09:21:06
Subject: Password?
Previous:From: Michael GouldDate: 2009-07-07 18:00:55
Subject: Table Partitioning

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