From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Sky <sky(at)sylvio(dot)hu>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Oid problem |
Date: | 2004-04-08 14:54:55 |
Message-ID: | 200404081554.55371.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Stark | 2004-04-08 15:24:00 | Re: Storing jpgs |
Previous Message | Jan Wieck | 2004-04-08 14:28:04 | Re: eval in plpgsl |