Search Postgresql Archives

Re: Oid problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 08 April 2004 15:21, Sky wrote:
> Problem:
> pg_loopen() unable to open PostgreSQL large object in...
>
> Solution from another mailing list:
> My blob oid was very big.
> I had to cast to (float) the oid parameter of pg_loopen.

Sorry, bigger than what? Why float?

> Question:
> The oid is a type, isn't it?

Yes

> I tried to use the oid in a function:
>
> CREATE FUNCTION addfoto(character varying, oid)
> RETURNS INTEGER
> AS
>  '
>  BEGIN;
>  INSERT INTO foto(filename, image) VALUES ( $1, $2 );
>  COMMIT;
>  SELECT 1 AS RESULT;
>  '
> LANGUAGE 'sql';

Assuming the definition of "foto" is OK, looks fine from here.

> So, What can I do, and how, how can I "CAST" ??

Sorry - dont understand, but you can cast by:

SELECT foo::int8 ...
SELECT CAST(foo as int8) ...


Is the problem that you want to handle oid's (0 .. 4 billion) and you are 
using int4 (-2 billion .. +2 billion). In which case int8 might be a better 
choice than int4.

HTH
-- 
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux