Convert bytea to Float8 - Mailing list pgsql-general

From Lee Keel
Subject Convert bytea to Float8
Date
Msg-id 76758090F8686C47A44B6FF52514A1D30904DED5@hermes.uai.int
Whole thread Raw
List pgsql-general

Can someone please answer what I hope to be an easy question?  I am trying to convert 8 bytes of a bytea into a float8. 

In C# this code looks like:

xCoord = System.BitConverter.ToDouble(arrByte, cnt) ;

But in my plpgsql function, the following gives me an error:

xCoord := substring(arrByte from cnt for 8)::float8;

The error that I get is:

ERROR: 42846: cannot cast type bytea to double precision

I have also tried get_byte, but that seems to only be returning the single byte and not all 8bytes for the float.  Thanks in advance.

Lee Keel

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

pgsql-general by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: Guideline on use of temporary tables
Next
From: Syan Tan
Date:
Subject: Re: atomic commit;begin for long running transactions , in combination with savepoint.