Upgrade 8.3

Started by E.J. Moloneyalmost 18 years ago3 messagesgeneral
Jump to latest
#1E.J. Moloney
emoloney@moloneyodeaassociates.co.uk

I am running the following query

update tempportfwdconnectiona set srcid=interface.objectid from
interface where tempportfwdconnectiona.hostid=interface.host and
tempportfwdconnectiona.spantreeport=interface.stpport

For application reasons the spantreeport in one table is a text field
and an integer in the other.

I am getting a cast error when I run this query which did work 8.2x, I
can't make both fields the same type is there any work around any body
can suggest.

I tried creating a cast but the interface function text_int no longer
exists.

Regards
E.J. Moloney

#2Craig Ringer
craig@2ndquadrant.com
In reply to: E.J. Moloney (#1)
Re: Upgrade 8.3

E.J. Moloney wrote:

I am running the following query

update tempportfwdconnectiona set srcid=interface.objectid from
interface where tempportfwdconnectiona.hostid=interface.host and
tempportfwdconnectiona.spantreeport=interface.stpport

For application reasons the spantreeport in one table is a text field
and an integer in the other.

I am getting a cast error when I run this query which did work 8.2x, I
can't make both fields the same type is there any work around any body
can suggest.

http://www.postgresql.org/docs/8.3/interactive/release-8-3.html#AEN85822

Try using an explicit cast, like CAST(spantreeport AS text) OR
CAST(spantreeport AS integer) .

--
Craig Ringer

#3Rodrigo Gonzalez
rjgonzale@gmail.com
In reply to: E.J. Moloney (#1)
Re: Upgrade 8.3

E.J. Moloney escribió:

I am running the following query

update tempportfwdconnectiona set srcid=interface.objectid from
interface where tempportfwdconnectiona.hostid=interface.host and
tempportfwdconnectiona.spantreeport=interface.stpport

For application reasons the spantreeport in one table is a text field
and an integer in the other.

I am getting a cast error when I run this query which did work 8.2x, I
can't make both fields the same type is there any work around any body
can suggest.

I tried creating a cast but the interface function text_int no longer
exists.

Regards
E.J. Moloney

Cast one to the other type

Considering stpport as integer you could

update tempportfwdconnectiona set srcid=interface.objectid from
interface where tempportfwdconnectiona.hostid=interface.host and
tempportfwdconnectiona.spantreeport=interface.stpport::text