Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 12:29 AM
Sky
Guest
 
Posts: n/a
Default Oid problem

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.

Question:
The oid is a type, isn't it?
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';

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

--
Sky
sky AT sylvio .hu
Debian Group - Association of Hungarian Linux Users
Accessibility Project leader
gpg --keyserver hkp://pgp.mit.edu --recv-keys 314D1B0C
fingerprint = B211 E8C7 C6C2 18B2 9F30 ADF6 EDD9 A7FA 314D 1B0C


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

  #2  
Old November 23rd, 2005, 12:29 AM
Richard Huxton
Guest
 
Posts: n/a
Default Re: Oid problem

On Thursday 08 April 2004 15:21, Sky wrote:[color=blue]
> 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.[/color]

Sorry, bigger than what? Why float?
[color=blue]
> Question:
> The oid is a type, isn't it?[/color]

Yes
[color=blue]
> 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';[/color]

Assuming the definition of "foto" is OK, looks fine from here.
[color=blue]
> So, What can I do, and how, how can I "CAST" ??[/color]

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

  #3  
Old November 23rd, 2005, 12:29 AM
Sky
Guest
 
Posts: n/a
Default Re: Oid problem

Richard Huxton írta:
[color=blue]
>On Thursday 08 April 2004 15:21, Sky wrote:
>
>[color=green]
>>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.
>>
>>[/color]
>
>Sorry, bigger than what? Why float?
>
>[/color]
Watch these links:
http://archives.postgresql.org/pgsql...9/msg00077.php
http://archives.postgresql.org/pgsql...9/msg00079.php
I found it by google.

This error message is my problem:
pg_loopen() unable to open large object
/ PHP4 /
[color=blue][color=green]
>>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';
>>
>>[/color]
>
>Assuming the definition of "foto" is OK, looks fine from here.
>
>
>[color=green]
>>So, What can I do, and how, how can I "CAST" ??
>>
>>[/color]
>
>Sorry - dont understand, but you can cast by:
>[/color]
Watch the links above.
[color=blue]
>
>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.
>[/color]
Sorry but I don't understand, where do I use int4 ??
Here is my table definition too:

CREATE TABLE foto(
filename CHARACTER VARYING,
image OID
);
[color=blue]
>
>HTH
>
>[/color]

Many thanks!

--
Sky
sky AT sylvio .hu
Debian Group - Association of Hungarian Linux Users
Accessibility Project leader
gpg --keyserver hkp://pgp.mit.edu --recv-keys 314D1B0C
fingerprint = B211 E8C7 C6C2 18B2 9F30 ADF6 EDD9 A7FA 314D 1B0C


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles